Skip to content

Commit 56175ec

Browse files
committed
snippet.detail added
1 parent bf560c2 commit 56175ec

9 files changed

Lines changed: 89 additions & 7 deletions

File tree

Gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ gulp.task('js', function(){
3232
gulp.task('sass', function () {
3333
return gulp.src('src/**/*.scss')
3434
.pipe(cached('styles'))
35-
.pipe(sass())
35+
.pipe(sass().on('error', sass.logError))
3636
.pipe(autoprefixer())
3737
.pipe(remember('styles'))
3838
.pipe(concat('all.css'))

src/modals/new-snippet-editor.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
$editor-border-color: $border-color;
44

55
.new-snippet-modal{
6-
6+
77
.ace_editor {
88
height: 200px;
99
border: solid 1px $editor-border-color;

src/services/snippet.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,15 @@ angular.module('codexen.services')
1616
return $http.post(url, params)
1717
}
1818

19+
var show = function (id) {
20+
var url = apiUrl + 'snippets/' + id
21+
22+
return $http.get(url)
23+
}
24+
1925
return {
2026
findByUser: findByUser,
21-
create: create
27+
create: create,
28+
show: show
2229
}
2330
})

src/states/clips/list.js

Whitespace-only changes.

src/states/home/home.tpl.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="home-state">
2-
<h1 class="jumbotron">Codexen App, v0.1 (breakthru)</h1>
2+
<h1 class="jumbotron">Codexen App <small>v0.1(breakthru)</small></h1>
33
<p>
44
App for Code snippets<br>
55

src/states/snippets/detail.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* global angular */
2+
angular.module('codexen.states')
3+
.controller('SnippetsDetailController', function (Snippet, $state) {
4+
var vm = this
5+
6+
vm.isLoaded = false
7+
8+
var snippetId = $state.params.id
9+
10+
Snippet.show(snippetId)
11+
.success(function (data) {
12+
vm.snippet = data.snippet
13+
vm.isLoaded = true
14+
})
15+
})
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<div class="snippets-detail-state">
2+
3+
<div class="detail-header">
4+
<span class="detail-header-title">
5+
<small>Title : </small>
6+
<span ng-bind="vm.snippet.title"></span></span>
7+
<span class="detail-header-control pull-right">
8+
<button type="button" name="button" class="btn btn-default"><i class="fa fa-share"></i></button>
9+
<button type="button" name="button" class="btn btn-default"><i class="fa fa-edit"></i></button>
10+
<button type="button" name="button" class="btn btn-danger"><i class="fa fa-trash"></i></button>
11+
</span>
12+
</div>
13+
14+
<div class="detail-body">
15+
16+
<div ng-if="!vm.isLoaded" class="">
17+
Loadding
18+
</div>
19+
20+
<div ng-if="vm.isLoaded" class="">
21+
<p>
22+
<span ng-repeat="tag in vm.snippet.tags" ng-bind="tag.name"></span>
23+
</p>
24+
<label>Description</label>
25+
<p ng-bind="vm.snippet.description"></p>
26+
<label>Content</label>
27+
<div ui-ace="{
28+
readonly: true,
29+
showGutter: false
30+
}" ng-model="vm.snippet.content"></div>
31+
</div>
32+
</div>
33+
</div>

src/states/snippets/list.tpl.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ <h4>
2323
<a ui-sref="auth.signin" class="btn btn-default"><i class="fa fa-signin"></i> Sign In</a>
2424
</li>
2525

26-
<li ng-repeat="snippet in vm.snippets">
26+
<li ng-repeat="snippet in vm.snippets" ui-sref="snippets.detail({id:snippet._id})">
2727
<div class="media">
2828
<div class="media-left">
2929
<img width="25" height="25" src="http://www.gravatar.com/avatar/ea0b6ad1c11700120d1af08810caa19d" alt="" />
@@ -42,9 +42,10 @@ <h4 ng-bind="snippet.title"></h4>
4242
</div>
4343

4444
<div class="right-pane">
45-
<div class="">
46-
45+
<div ng-if="'snippets'|isState">
46+
No snippet selected.
4747
</div>
48+
<div ui-view></div>
4849
</div>
4950

5051

src/states/snippets/snippets.scss

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,29 @@ $snippet-list-item-hover-bg: #EEE;
4949
right: 0;
5050
}
5151
}
52+
53+
.snippets-detail-state{
54+
.detail-header{
55+
padding: 5px 10px;
56+
height: 50px;
57+
border-bottom: solid 1px $border-color;
58+
.detail-header-title{
59+
small{
60+
font-size: 0.6em;
61+
}
62+
line-height: 40px;
63+
font-size: 1.2em;
64+
}
65+
.detail-header-control{
66+
padding:3px;
67+
}
68+
}
69+
.detail-body{
70+
padding: 5px 10px;
71+
.ace_editor {
72+
height: 500px;
73+
border: solid 1px $border-color;
74+
border-radius: 5px;
75+
}
76+
}
77+
}

0 commit comments

Comments
 (0)