Commit fc67370ef4c2e7eb747706a5a4ce08396545bfcf
- Diff rendering mode:
- inline
- side by side
static/css/mouchak.css
(6 / 0)
  | |||
1 | .title { | ||
2 | text-align: center; | ||
3 | margin: 0 auto; | ||
4 | padding: 3px; | ||
5 | font-size: 1.5em; | ||
6 | } |
static/js/editor.js
(4 / 1)
  | |||
107 | 107 | this.render(); | |
108 | 108 | }, | |
109 | 109 | nameChanged: function(page) { | |
110 | M.pagelistview.render(); | ||
110 | //M.pagelistview.render(); | ||
111 | 111 | console.log('name changed', page); | |
112 | 112 | }, | |
113 | 113 | render: function() { | |
… | … | ||
209 | 209 | console.log('saved', model, response); | |
210 | 210 | model.set(response.page); | |
211 | 211 | model.id = response.page.id; | |
212 | //console.log(model); | ||
213 | //console.log(M.pages.models); | ||
214 | M.pagelistview.render(); | ||
212 | 215 | }, | |
213 | 216 | error: function(model, xhr) { | |
214 | 217 | console.log('failed', model, xhr); |
static/js/mouchak.js
(26 / 15)
  | |||
14 | 14 | }, | |
15 | 15 | render: function() { | |
16 | 16 | var menu = new M.types.model.menu(M.site_content.menu); | |
17 | var navview = new NavigationView({model: menu}); | ||
18 | navview.render(); | ||
17 | var navView = new NavigationView({model: menu}); | ||
18 | navView.render(); | ||
19 | this.navView = navView; | ||
19 | 20 | }, | |
20 | 21 | updateBreadcrumbs: function(event) { | |
21 | 22 | //TODO: write code to use bootstrap's breadcrumbs to render a | |
… | … | ||
27 | 27 | var NavigationView = Backbone.View.extend({ | |
28 | 28 | el: '#navigation', | |
29 | 29 | events: { | |
30 | 'click .nav li a' : 'navClicked' | ||
30 | 'click .nav li a' : 'navClicked', | ||
31 | 'navclicked': 'navClicked' | ||
31 | 32 | }, | |
32 | 33 | initialize: function() { | |
33 | 34 | _.bindAll(this); | |
34 | 35 | this.template = _.template($('#nav-bar-template').html()); | |
36 | this.bind('navclicked', this.navClicked); | ||
35 | 37 | }, | |
36 | 38 | render: function() { | |
37 | 39 | // if custom menu is not defined, render a default menu | |
… | … | ||
49 | 49 | console.log('rendering custom menu..'); | |
50 | 50 | this.$el.append(this.model.get('html')); | |
51 | 51 | } | |
52 | var fragment = location.hash.split('/')[1]; | ||
53 | var pos = _.indexOf(M.pages.models, M.pages.where({'name': fragment})[0]); | ||
54 | if(!fragment) { | ||
55 | pos = 0; | ||
56 | } | ||
57 | $(this.$links[pos]).addClass('active'); | ||
52 | 58 | }, | |
53 | 59 | populate: function() { | |
54 | 60 | var item_template = _.template($('#nav-item-template').html()); | |
… | … | ||
66 | 66 | })); | |
67 | 67 | }, this); | |
68 | 68 | this.$links = $('.nav li'); | |
69 | //console.log(this.$links[0]); | ||
70 | $(this.$links[0]).addClass('active'); | ||
71 | 69 | }, | |
72 | 70 | navClicked: function(event) { | |
73 | console.log('navClicked'); | ||
74 | 71 | this.$links.removeClass('active'); | |
75 | $(event.currentTarget).parent().addClass('active'); | ||
72 | if(!event) { | ||
73 | var fragment = location.hash.split('/')[1]; | ||
74 | var pos = _.indexOf(M.pages.models, M.pages.where({'name': fragment})[0]); | ||
75 | if(!fragment) { | ||
76 | pos = 0; | ||
77 | } | ||
78 | $(this.$links[pos]).addClass('active'); | ||
79 | } | ||
80 | else { | ||
81 | $(event.currentTarget).parent().addClass('active'); | ||
82 | } | ||
76 | 83 | } | |
77 | 84 | }); | |
78 | 85 | ||
79 | 86 | var AppRouter = Backbone.Router.extend({ | |
80 | 87 | routes : { | |
81 | //'index' : 'index', | ||
82 | 88 | ':page' : 'showPage' | |
83 | 89 | }, | |
84 | /*index: function() { | ||
85 | $('.pageview').hide(); | ||
86 | var id = nameIdMap['index']; | ||
87 | $('#'+id).show(); | ||
88 | },*/ | ||
89 | 90 | showPage: function(page) { | |
90 | 91 | $('.pageview').hide(); | |
91 | 92 | //news pages are rendered on the fly, | |
… | … | ||
107 | 107 | else { | |
108 | 108 | $('#navigation').show(); | |
109 | 109 | } | |
110 | M.appView.navView.trigger('navclicked'); | ||
110 | 111 | }, | |
111 | 112 | render404: function() { | |
112 | 113 | $('.pageview').hide(); | |
… | … | ||
164 | 164 | var app_router = new AppRouter(); | |
165 | 165 | Backbone.history.start(); | |
166 | 166 | ||
167 | var startpage = M.pages.models[0].get('name'); | ||
168 | app_router.navigate(startpage, {trigger: true}); | ||
167 | //var startpage = M.pages.models[0].get('name'); | ||
168 | //app_router.navigate(startpage, {trigger: true}); | ||
169 | 169 | ||
170 | 170 | //M.simHeir(); | |
171 | 171 | }; |
static/js/views.js
(1 / 1)
  | |||
122 | 122 | render: function() { | |
123 | 123 | $('#content-container').append(this.el); | |
124 | 124 | //this.appendNavTemplate(); | |
125 | $(this.el).append('<h3>'+this.model.get('title')+'</h3>'); | ||
125 | $(this.el).append('<div class="title">'+this.model.get('title')+'</div>'); | ||
126 | 126 | var self = this; | |
127 | 127 | _.each(this.model.get('content'), function(item) { | |
128 | 128 | var view = M.types.view[item.get('type')]; |
templates/index.html
(1 / 0)
  | |||
14 | 14 | ||
15 | 15 | <link rel="stylesheet" href="/static/css/normalize.css"> | |
16 | 16 | <link rel="stylesheet" href="/static/css/bootstrap.css"> | |
17 | <link rel="stylesheet" href="/static/css/mouchak.css"> | ||
17 | 18 | <link rel="stylesheet" href="/static/css/main.css"> | |
18 | 19 | <script src="/static/js/lib/modernizr-2.6.1.min.js"></script> | |
19 | 20 | </head> |