comable_backend 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/comable/admin/application.coffee +53 -99
  3. data/app/assets/javascripts/comable/admin/categories.coffee +59 -0
  4. data/app/assets/javascripts/comable/admin/dashboard.coffee +32 -0
  5. data/app/assets/javascripts/comable/admin/dispatcher.coffee +21 -0
  6. data/app/assets/javascripts/comable/admin/orders.coffee +44 -0
  7. data/app/assets/javascripts/comable/admin/pages.coffee +69 -0
  8. data/app/assets/javascripts/comable/admin/products.coffee +21 -0
  9. data/app/assets/javascripts/comable/admin/search.coffee +35 -0
  10. data/app/assets/javascripts/comable/admin/themes.coffee +64 -0
  11. data/app/assets/stylesheets/comable/admin/_common.scss +1 -163
  12. data/app/assets/stylesheets/comable/admin/_overrides.scss +1 -0
  13. data/app/assets/stylesheets/comable/admin/_pages.scss +30 -0
  14. data/app/assets/stylesheets/comable/admin/_themes.scss +71 -0
  15. data/app/assets/stylesheets/comable/admin/_user_sessions.scss +4 -4
  16. data/app/assets/stylesheets/comable/admin/_variables.scss +16 -19
  17. data/app/assets/stylesheets/comable/admin/application.scss +6 -1
  18. data/app/assets/stylesheets/comable/admin/overrides/awesome_admin_layout.scss +25 -0
  19. data/app/assets/stylesheets/comable/admin/overrides/bootstrap.scss +5 -12
  20. data/app/controllers/comable/admin/orders_controller.rb +5 -1
  21. data/app/controllers/comable/admin/pages_controller.rb +72 -0
  22. data/app/controllers/comable/admin/themes_controller.rb +101 -0
  23. data/app/controllers/comable/admin/user_sessions_controller.rb +1 -0
  24. data/app/controllers/comable/admin/users_controller.rb +5 -0
  25. data/app/helpers/comable/admin/application_helper.rb +4 -4
  26. data/app/helpers/comable/admin/pages_helper.rb +6 -0
  27. data/app/helpers/comable/admin/themes_helper.rb +69 -0
  28. data/app/views/comable/admin/categories/index.slim +1 -52
  29. data/app/views/comable/admin/dashboard/show.slim +3 -23
  30. data/app/views/comable/admin/orders/_google_map.slim +26 -9
  31. data/app/views/comable/admin/orders/edit.slim +62 -4
  32. data/app/views/comable/admin/pages/_form.slim +69 -0
  33. data/app/views/comable/admin/pages/edit.slim +31 -0
  34. data/app/views/comable/admin/pages/index.slim +55 -0
  35. data/app/views/comable/admin/pages/new.slim +16 -0
  36. data/app/views/comable/admin/products/_form.slim +0 -16
  37. data/app/views/comable/admin/shared/_advanced_search.slim +0 -1
  38. data/app/views/comable/admin/shared/_notifier.slim +2 -2
  39. data/app/views/comable/admin/themes/_editor.slim +8 -0
  40. data/app/views/comable/admin/themes/_form.slim +31 -0
  41. data/app/views/comable/admin/themes/edit.slim +35 -0
  42. data/app/views/comable/admin/themes/index.slim +37 -0
  43. data/app/views/comable/admin/themes/new.slim +16 -0
  44. data/app/views/comable/admin/themes/show_file.slim +93 -0
  45. data/app/views/layouts/comable/admin/application.slim +19 -11
  46. data/config/initializers/awesome_admin_layout.rb +110 -0
  47. data/config/routes.rb +13 -0
  48. data/lib/comable/backend/engine.rb +8 -1
  49. metadata +117 -11
  50. data/app/assets/javascripts/comable/admin/products.js +0 -2
  51. data/app/views/comable/admin/shared/_header.slim +0 -31
  52. data/app/views/comable/admin/shared/_setup_search_form.slim +0 -14
  53. data/app/views/comable/admin/shared/_sidebar.slim +0 -54
@@ -0,0 +1,64 @@
1
+ can_use_comable_theme_editor = ->
2
+ return false unless $('#comable-theme-editor').length
3
+ return false unless $('#comable-theme-editor-form').length
4
+ true
5
+
6
+ can_use_comable_file_tree = ->
7
+ return false unless $('#comable-file-tree').length
8
+ true
9
+
10
+ comable_theme_editor_window = ->
11
+ editor_element = $('#comable-theme-editor').find('.comable-theme-editor-window').get(0)
12
+ ace.edit(editor_element)
13
+
14
+ initializa_comable_theme_editor = ->
15
+ editor = comable_theme_editor_window()
16
+ editor.setTheme('ace/theme/monokai')
17
+ editor.session.setMode('ace/mode/liquid')
18
+ $(window).bind('beforeunload', ->
19
+ window.beforeunload_message unless editor.session.getUndoManager().isClean()
20
+ )
21
+ $(document).on('page:before-change', ->
22
+ confirm(window.beforeunload_message) unless editor.session.getUndoManager().isClean()
23
+ )
24
+
25
+ add_comable_theme_editor_form_event = ->
26
+ $form = $('#comable-theme-editor-form')
27
+ $form.submit(->
28
+ editor = comable_theme_editor_window()
29
+ text = editor.getValue()
30
+ $(this).find('[name=code]').val(text)
31
+ )
32
+
33
+ add_comable_file_tree_event = ->
34
+ $comable_file_tree = $('#comable-file-tree')
35
+ $comable_file_tree.find('a').click((event) ->
36
+ event.preventDefault()
37
+ path = $(this).attr('href')
38
+ page_before_change = jQuery.Event('page:before-change')
39
+ $(document).trigger(page_before_change)
40
+ Turbolinks.visit(path) unless page_before_change.isDefaultPrevented()
41
+ )
42
+
43
+ resize_forms_height = ->
44
+ header_height = parseInt($('.comable-page-body').css('padding-top'))
45
+ footer_height = $('footer').outerHeight(true)
46
+ main_height = $(window).height() - header_height - footer_height
47
+ $comable_file_tree = $('#comable-file-tree')
48
+ $comable_file_tree.css('height', main_height + 'px') if $comable_file_tree.length
49
+ $comable_theme_editor = $('#comable-theme-editor')
50
+ $comable_theme_editor.css('height', main_height + 'px') if $comable_theme_editor.length
51
+
52
+ $(document).ready(->
53
+ if can_use_comable_theme_editor()
54
+ initializa_comable_theme_editor()
55
+ add_comable_theme_editor_form_event()
56
+ if can_use_comable_file_tree()
57
+ resize_forms_height()
58
+ add_comable_file_tree_event()
59
+ )
60
+
61
+ $(window).resize(->
62
+ return unless can_use_comable_file_tree()
63
+ resize_forms_height()
64
+ )
@@ -17,7 +17,6 @@ footer {
17
17
  #wrapper {
18
18
  display: table;
19
19
  width: 100%;
20
- position: absolute;
21
20
  height: 100%;
22
21
 
23
22
  body.animated & {
@@ -60,167 +59,6 @@ footer {
60
59
  }
61
60
  }
62
61
 
63
- .sidebar {
64
- display: table-cell;
65
- position: relative;
66
- vertical-align: top;
67
- padding-bottom: 200px;
68
- border-right: 1px solid $comable-sidebar-border;
69
-
70
- & {
71
- background-color: $comable-sidebar-bg;
72
- width: $comable-sidebar-width;
73
- z-index: 300;
74
- }
75
- }
76
-
77
- .vnavigation {
78
- width: $comable-sidebar-width;
79
- background-color: $comable-sidebar-bg;
80
- border-right: 1px solid $comable-sidebar-border;
81
- position: fixed;
82
-
83
- a {
84
- &:link,
85
- &:visited,
86
- &:hover,
87
- &:active {
88
- color: $comable-sidebar-link-color;
89
- text-decoration: none;
90
- }
91
-
92
- &:hover {
93
- color: $comable-sidebar-link-hover-color;
94
- }
95
- }
96
-
97
- ul {
98
- margin: 0;
99
- padding: 0;
100
- }
101
-
102
- & > ul {
103
- margin: 5px 0;
104
-
105
- & > li > a {
106
- display: block;
107
- padding: 12px 25px;
108
- font-size: 13px;
109
- font-weight: 400;
110
- white-space: nowrap;
111
- border-left: 2px solid transparent;
112
- }
113
-
114
- &> li.active > a {
115
- color: $comable-sidebar-link-active-color;
116
- background-color: $comable-sidebar-link-active-bg;
117
-
118
- i {
119
- text-align: center;
120
- width: 20px;
121
- font-size: 14px;
122
- margin-right: 7px;
123
- }
124
- }
125
- }
126
-
127
- li {
128
- margin: 0;
129
- padding: 0;
130
- list-style: none;
131
- }
132
-
133
- & > ul > li > a {
134
- &:hover {
135
- @include transition(color 250ms ease, background-color 250ms ease);
136
- background-color: $comable-sidebar-link-hover-bg;
137
- }
138
-
139
- i {
140
- text-align: center;
141
- width: 20px;
142
- font-size: 14px;
143
- margin-right: 7px;
144
- }
145
- }
146
-
147
- li.parent {
148
- & > a {
149
- //@include glyphicon(chevron-right, $float: right);
150
- @include fa(angle-right, $float: right);
151
- }
152
-
153
- & > ul {
154
- display: none;
155
- padding: 14px 0;
156
- background-color: $comable-sidebar-darken-bg;
157
-
158
- a {
159
- display: block;
160
- padding: 7px 42px;
161
-
162
- &:link, &:visited, &:hover, &:active {
163
- color: $comable-sidebar-darken-color;
164
- }
165
-
166
- &:hover {
167
- @include transition(color 250ms ease, background-color 250ms ease);
168
- color: $comable-sidebar-darken-hover-color;
169
- background-color: $comable-sidebar-darken-hover-bg;
170
- }
171
-
172
- border-left: 2px solid transparent;
173
- }
174
-
175
- .active > a {
176
- color: $comable-sidebar-darken-active-color;
177
- background-color: $comable-sidebar-darken-active-bg;
178
- border-left: 2px solid $comable-theme-bg;
179
- }
180
- }
181
- }
182
- }
183
-
184
- #comable-affix {
185
- @extend .hidden-sm;
186
- @extend .hidden-xs;
187
-
188
- &.affix {
189
- top: $navbar-height + 20px;
190
- }
191
-
192
- .list-group > a:before {
193
- @include fa(angle-right);
194
- margin-right: 1em;
195
- }
196
- }
197
-
198
- #comable-notifier {
199
- @include opacity(0.95);
200
- width: 100%;
201
- overflow: hidden;
202
- position: fixed;
203
- top: 0;
204
- left: 0;
205
- z-index: 999999;
206
-
207
- & > * {
208
- padding: 0 1em;
209
- height: $navbar-height;
210
- line-height: $navbar-height;
211
-
212
- &.comable-alert {
213
- color: $alert-danger-text;
214
- background-color: $alert-danger-bg;
215
- }
216
-
217
- &.comable-notice {
218
- color: $alert-success-text;
219
- background-color: $alert-success-bg;
220
- }
221
- }
222
- }
223
-
224
62
  .comable-page-heading {
225
63
  margin: 0 -15px 25px;
226
64
  padding: 25px 30px;
@@ -246,7 +84,7 @@ footer {
246
84
  }
247
85
 
248
86
  .comable-main-fixed-top {
249
- padding-left: $comable-sidebar-width;
87
+ padding-left: $awesome_admin_layout-navigation-width;
250
88
  width: 100%;
251
89
  background-color: #fff;
252
90
  position: fixed;
@@ -1,3 +1,4 @@
1
1
  @import 'comable/admin/overrides/bootstrap';
2
2
  @import 'comable/admin/overrides/jstree';
3
3
  @import 'comable/admin/overrides/tagit';
4
+ @import 'comable/admin/overrides/awesome_admin_layout';
@@ -0,0 +1,30 @@
1
+ .slug {
2
+ @include display-flex;
3
+
4
+ .slug-url {
5
+ @include flex(0 0 auto);
6
+ @include nowrap;
7
+ @include border-top-left-radius($input-border-radius);
8
+ @include border-bottom-left-radius($input-border-radius);
9
+ border: 1px solid $input-border;
10
+ border-right: 0;
11
+ background: $input-bg-disabled;
12
+
13
+ span {
14
+ @include inline-block;
15
+ color: lighten($input-color, 15%);
16
+ padding: 6px 12px;
17
+ padding-right: 6px;
18
+ }
19
+ }
20
+
21
+ .slug-body {
22
+ @include flex(1 1 0%);
23
+
24
+ input{
25
+ @include border-top-left-radius(0px);
26
+ @include border-bottom-left-radius(0px);
27
+ padding-left: 6px;
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,71 @@
1
+ #comable-theme-editor {
2
+ position: relative;
3
+
4
+ .comable-theme-editor-filename {
5
+ @include border-top-radius($input-border-radius);
6
+ @include nowrap;
7
+ padding: 0 15px;
8
+ height: $comable-theme-editor-filename-height;
9
+ line-height: $comable-theme-editor-filename-height;
10
+ color: $comable-theme-editor-color;
11
+ background-color: $comable-theme-editor-filename-bg;
12
+ overflow: hidden;
13
+ }
14
+
15
+ .comable-theme-editor-window {
16
+ @include border-bottom-radius($input-border-radius);
17
+ position: absolute;
18
+ top: $comable-theme-editor-filename-height;
19
+ left: 0;
20
+ bottom: 0;
21
+ right: 0;
22
+ }
23
+
24
+ .panel {
25
+ display: table;
26
+ width: 100%;
27
+ height: 100%;
28
+ color: $comable-theme-editor-color;
29
+ background-color: $comable-theme-editor-bg;
30
+
31
+ .panel-body {
32
+ display: table-cell;
33
+ vertical-align: middle;
34
+ text-align: center;
35
+ }
36
+ }
37
+ }
38
+
39
+
40
+ #comable-file-tree {
41
+ @include border-radius($input-border-radius);
42
+ @include box-shadow(inset 0 1px 1px rgba(0, 0, 0, 0.075));
43
+ margin-bottom: 15px;
44
+ padding: 5px 0;
45
+ border: 1px solid $input-border;
46
+ overflow: auto;
47
+
48
+ dl {
49
+ $indent: 1.5em;
50
+ margin-bottom: 0;
51
+
52
+ dl {
53
+ text-indent: $indent;
54
+ dl {
55
+ text-indent: $indent * 2;
56
+ }
57
+ }
58
+ }
59
+
60
+ dt, a {
61
+ display: block;
62
+ padding: 5px 10px;
63
+ }
64
+
65
+ a {
66
+ &:hover, &:active {
67
+ color: $dropdown-link-active-color;
68
+ background-color: $dropdown-link-active-bg;
69
+ }
70
+ }
71
+ }
@@ -1,6 +1,6 @@
1
1
  #comable-user_session {
2
2
  margin: 0;
3
- background-color: $comable-sidebar-bg;
3
+ background-color: $comable-signin-bg;
4
4
  font-size: 12px;
5
5
  font-family: 'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;
6
6
 
@@ -11,7 +11,7 @@
11
11
  }
12
12
 
13
13
  .comable-signin {
14
- background-color: $navbar-default-bg;
14
+ background-color: $comable-signin-body-bg;
15
15
 
16
16
  & > .comable-signin-heading {
17
17
  position: absolute;
@@ -23,7 +23,7 @@
23
23
  margin-left: -225px;
24
24
 
25
25
  & > h1 {
26
- color: $comable-sidebar-title-color;
26
+ color: $comable-signin-color;
27
27
  font-size: 28px;
28
28
  font-weight: 300;
29
29
  line-height: 110%;
@@ -40,7 +40,7 @@
40
40
 
41
41
  .comable-signin-body {
42
42
  padding: 30px 40px;
43
- color: $navbar-default-color;
43
+ color: $comable-signin-body-color;
44
44
  width: 450px;
45
45
  margin: 0 auto;
46
46
 
@@ -1,22 +1,10 @@
1
1
  $comable-theme-bg: #7761a7;
2
2
 
3
- // sidebar
4
- $comable-sidebar-width: 280px;
5
- $comable-sidebar-bg: #d9e0e7;
6
- $comable-sidebar-color: #444;
7
- $comable-sidebar-title-color: #666;
8
- $comable-sidebar-border: darken($comable-sidebar-bg, 10%);
9
- $comable-sidebar-link-color: $comable-sidebar-color;
10
- $comable-sidebar-link-hover-color: #000;
11
- $comable-sidebar-link-active-color: #fff;
12
- $comable-sidebar-link-hover-bg: darken($comable-sidebar-bg, 10%);
13
- $comable-sidebar-link-active-bg: $comable-theme-bg;
14
- $comable-sidebar-darken-bg: darken($comable-sidebar-bg, 15%);
15
- $comable-sidebar-darken-hover-bg: rgba(0, 0, 0, 0.2);
16
- $comable-sidebar-darken-active-bg: $comable-sidebar-darken-hover-bg;
17
- $comable-sidebar-darken-color: $comable-sidebar-color;
18
- $comable-sidebar-darken-hover-color: #fff;
19
- $comable-sidebar-darken-active-color: $comable-sidebar-darken-hover-color;
3
+ // signin
4
+ $comable-signin-bg: #d9e0e7;
5
+ $comable-signin-color: #666;
6
+ $comable-signin-body-bg: #373737;
7
+ $comable-signin-body-color: #aaa;
20
8
 
21
9
  // orders
22
10
  $comable-map-height: 160px;
@@ -24,6 +12,12 @@ $comable-avatar-size: 80px;
24
12
  $comable-address-icon-size: 20px;
25
13
  $comable-address-icon-margin: 15px;
26
14
 
15
+ // themes
16
+ $comable-theme-editor-color: #8F908A;
17
+ $comable-theme-editor-bg: #272822;
18
+ $comable-theme-editor-filename-bg: #2F3129;
19
+ $comable-theme-editor-filename-height: 35px;
20
+
27
21
  // bootstrap
28
22
  $navbar-default-color: #aaa;
29
23
  $navbar-default-bg: #373737;
@@ -37,5 +31,8 @@ $navbar-default-brand-hover-color: $navbar-default-brand-color;
37
31
  $navbar-default-toggle-icon-bar-bg: $navbar-default-link-color;
38
32
  $navbar-default-toggle-hover-bg: $navbar-default-link-hover-bg;
39
33
 
40
- // $panel-default-heading-bg: $comable-sidebar-bg;
41
- // $panel-default-border: $comable-sidebar-border;
34
+ // ngprogress
35
+ $nprogress-color: $comable-theme-bg;
36
+
37
+ // awesome_admin_layout
38
+ $awesome_admin_layout-navigation-item-active-bg: $comable-theme-bg;
@@ -7,8 +7,11 @@
7
7
  @import 'font-awesome';
8
8
  @import 'jquery-ui';
9
9
  @import 'morris';
10
- @import 'pace/white/pace-theme-minimal';
10
+ @import 'nprogress';
11
+ @import 'nprogress-bootstrap';
11
12
  @import 'gritter';
13
+ @import 'awesome_admin_layout';
14
+ @import 'bootstrap-datetimepicker';
12
15
 
13
16
  @import 'comable/admin/mixins';
14
17
  @import 'comable/admin/overrides';
@@ -18,4 +21,6 @@
18
21
  @import 'comable/admin/dashboard';
19
22
  @import 'comable/admin/orders';
20
23
  @import 'comable/admin/products';
24
+ @import 'comable/admin/pages';
21
25
  @import 'comable/admin/user_sessions';
26
+ @import 'comable/admin/themes';