sunrise-cms 0.5.0.rc2 → 0.5.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/CHANGELOG.rdoc +7 -0
  2. data/README.md +123 -0
  3. data/app/assets/javascripts/sunrise/application.js +1 -2
  4. data/app/assets/javascripts/sunrise/jquery.ddmenu.js.coffee +9 -0
  5. data/app/assets/{stylesheets/sunrise/ie.css → javascripts/sunrise/redactor.js} +0 -0
  6. data/app/assets/stylesheets/sunrise/customize.css +63 -1
  7. data/app/assets/stylesheets/sunrise/main.css +7 -7
  8. data/app/views/layouts/sunrise/application.html.erb +0 -4
  9. data/app/views/sunrise/manager/buttons/_delete.html.erb +5 -0
  10. data/app/views/sunrise/manager/buttons/_edit.html.erb +5 -0
  11. data/app/views/sunrise/manager/buttons/_export.html.erb +5 -0
  12. data/app/views/sunrise/manager/buttons/_new.html.erb +5 -0
  13. data/app/views/sunrise/manager/buttons/_sort.html.erb +20 -0
  14. data/app/views/sunrise/shared/_panel.html.erb +32 -49
  15. data/app/views/sunrise/shared/_toolbar.html.erb +10 -48
  16. data/config/locales/sunrise/en.yml +3 -0
  17. data/config/locales/sunrise/ru.yml +4 -0
  18. data/config/locales/sunrise/uk.yml +4 -0
  19. data/lib/generators/sunrise/templates/config/seeds.rb +2 -3
  20. data/lib/sunrise/config/list.rb +5 -0
  21. data/lib/sunrise/config.rb +4 -0
  22. data/lib/sunrise/version.rb +1 -1
  23. data/spec/dummy/app/models/sunrise/sunrise_post.rb +3 -1
  24. data/spec/dummy/config/application.rb +4 -0
  25. data/spec/dummy/log/development.log +150 -0
  26. data/spec/dummy/log/test.log +7881 -0
  27. data/spec/dummy/tmp/cache/assets/C7B/190/sprockets%2F37b103f4623089af1456b90830fe941c +0 -0
  28. data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  29. data/spec/dummy/tmp/cache/assets/D13/C60/sprockets%2F2dedb8177c20286c4259c1d58c5646cc +0 -0
  30. data/spec/dummy/tmp/cache/assets/D21/5D0/sprockets%2Fe2c4f946939f2d7d0b42d86383755cae +0 -0
  31. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  32. data/spec/dummy/tmp/cache/assets/D3E/F40/sprockets%2F25a167c7563d6fe8ec6b13ec1ac09274 +0 -0
  33. data/spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  34. data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  35. data/spec/dummy/tmp/cache/assets/D66/D60/sprockets%2F74fff4cd40e651309f6a03b2acc63a93 +0 -0
  36. data/spec/dummy/tmp/cache/assets/D6A/A70/sprockets%2F88c982cf93bc6d8f73d7a3968bb769e7 +0 -0
  37. data/spec/dummy/tmp/cache/assets/D96/A50/sprockets%2F5f2f70550f68122b1cacdcab9a45ed67 +0 -0
  38. data/spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  39. data/spec/dummy/tmp/cache/assets/DDE/270/sprockets%2F0dd428ae1aed245ab1c713f6f0aabb06 +0 -0
  40. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  41. data/spec/tmp/config/application.rb +4 -0
  42. data/spec/tmp/db/seeds.rb +2 -3
  43. metadata +40 -7
  44. data/README.rdoc +0 -90
  45. data/app/views/sunrise/shared/_head.html.erb +0 -22
  46. data/vendor/assets/javascripts/jquery.fancybox-1.3.4.pack.js +0 -46
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.5.0
2
+ * Dynamic navigation
3
+ * Role type now in user model
4
+ * Special file - "redactor.js" for includes external files
5
+ * Mongoid support
6
+ * And many others small changes
7
+
1
8
  == 0.3.0
2
9
  * New manager for models aka rails_admin
3
10
  * New filter
data/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # Sunrise CMS
2
+
3
+ Open source mini content management system for programmers.
4
+
5
+ ## Instructions
6
+
7
+ ### ActiveRecord
8
+
9
+ List of gems for [active_record](https://gist.github.com/4529926#file-gemfile-active_record).
10
+
11
+ ```bash
12
+ $> rails g devise:install
13
+ $> rails g audited:install
14
+ $> rails g sunrise:install --orm=active_record
15
+ ```
16
+
17
+ Copy db migrations files:
18
+
19
+ ```bash
20
+ $> rake sunrise:install:migrations
21
+ $> rake page_parts_engine:install:migrations
22
+ $> rake meta_manager_engine:install:migrations
23
+ ```
24
+
25
+ ### Mongoid
26
+
27
+ List of gems for [mongoid](https://gist.github.com/4529926#file-gemfile-mongoid).
28
+
29
+ ```bash
30
+ $> rails g sunrise:install --orm=mongoid
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ Just create class:
36
+
37
+ ```ruby
38
+ class SunriseProduct < Sunrise::AbstractModel
39
+ self.resource_name = "Product"
40
+
41
+ list :thumbs do
42
+ scope { Product.includes(:picture) }
43
+ preview { lambda { |product| product.picture.try(:url, :thumb) } }
44
+
45
+ field :title
46
+ field :price
47
+ field :total_stock
48
+ end
49
+
50
+ show do
51
+ field :title
52
+ field :price
53
+ field :total_stock
54
+ field :sort_order
55
+ field :is_visible
56
+ end
57
+
58
+ edit do
59
+ field :title
60
+ field :price
61
+ field :total_stock
62
+ field :notes
63
+
64
+ group :sidebar, :holder => :sidebar do
65
+ field :sale_limit_id, :collection => lambda { SaleLimit.all }, :include_blank => false
66
+ field :sort_order
67
+ field :is_visible, :boolean => true
68
+ end
69
+
70
+ group :bottom, :holder => :bottom do
71
+ nested_attributes :variants do
72
+ field :size
73
+ field :total_stock, :div_style => 'width:100%;clear:both;'
74
+ field :item_model_id, :collection => lambda { ItemModel.all }, :include_blank => false
75
+ end
76
+
77
+ field :picture, :as => :uploader
78
+ end
79
+ end
80
+ end
81
+ ```
82
+
83
+ ### Export data
84
+
85
+ #### XML, JSON, CSV
86
+
87
+ ```
88
+ GET /manage/users/export.xml
89
+ GET /manage/users/export.csv
90
+ ```
91
+
92
+ #### JSON
93
+
94
+ ```
95
+ GET /manage/users/export.json
96
+ ```
97
+
98
+ For more info look at jbuilder https://rubygems.org/gems/jbuilder.
99
+
100
+ #### Excel
101
+
102
+ ```
103
+ gem "ruby2xlsx", "~> 0.0.1"
104
+
105
+ GET /manage/users/export.xlsx
106
+ ```
107
+
108
+ ### Include additional js codes
109
+
110
+ For example your want to include ckeditor editor.
111
+ In "Gemfile" include gem:
112
+
113
+ ```ruby
114
+ gem "ckeditor"
115
+ ```
116
+
117
+ Create file "app/assets/javascripts/sunrise/redactor.js":
118
+
119
+ ```
120
+ //= require ckeditor/init
121
+ ```
122
+
123
+ Copyright (c) 2013 Fodojo, released under the MIT license
@@ -3,7 +3,6 @@
3
3
  //= require jquery-ui
4
4
 
5
5
  //= require jquery.tmpl.min
6
- //= require jquery.fancybox-1.3.4.pack
7
6
  //= require jquery.cookie
8
7
  //= require jquery-ui-timepicker-addon
9
8
  //= require datepicker/jquery.ui.datepicker-uk
@@ -18,4 +17,4 @@
18
17
  //= require sunrise/jquery.pagination
19
18
 
20
19
  //= require sunrise/manage
21
- //= require ckeditor/init
20
+ //= require sunrise/redactor
@@ -57,8 +57,17 @@ class DropdownMenu
57
57
 
58
58
  this.hide() if !node.hasClass('ddm-container') and node.parents('.ddm-container').length is 0
59
59
 
60
+ _position: () ->
61
+ pos = @element.position()
62
+
63
+ pos.top += @element.height()
64
+ pos.left -= 5
65
+
66
+ @container.css(pos)
67
+
60
68
  show: (event) ->
61
69
  @element.addClass "ddm-active"
70
+ this._position()
62
71
  this.fadeIn()
63
72
 
64
73
  this.killer()
@@ -99,4 +99,66 @@ input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focu
99
99
  .nested .title-switcher {
100
100
  float:none;
101
101
  }
102
- /* End nested form */
102
+ /* End nested form */
103
+
104
+ /* Main panel */
105
+ .top-wrapper .menu-holder .main-menu .main {
106
+ display: block;
107
+ width: 150px;
108
+ overflow: hidden;
109
+ background: url(/assets/sunrise/top_logo.png) no-repeat 30px center;
110
+ padding: 0 30px 0 60px;
111
+ }
112
+ .top-wrapper .menu-holder .main-menu .creates {
113
+ display: block;
114
+ width: 75px;
115
+ overflow: hidden;
116
+ background: url(/assets/sunrise/top_plus.png) no-repeat 15px center;
117
+ padding: 0 20px 0 35px;
118
+ }
119
+ .top-wrapper .menu-holder .main-menu .main .arr,
120
+ .top-wrapper .menu-holder .main-menu .creates .arr {
121
+ display: block;
122
+ overflow: hidden;
123
+ background: url(/assets/sunrise/top_arr_down.png) no-repeat right center;
124
+ padding-right: 15px;
125
+ }
126
+ .top-wrapper .menu-holder .main-menu li .ddm-active .main .arr,
127
+ .top-wrapper .menu-holder .main-menu li .ddm-active .creates .arr {
128
+ background: url(/assets/sunrise/top_arr_up.png) no-repeat right center !important;
129
+ }
130
+
131
+ /*.sub-wrapper .default-list li a {
132
+ padding: 10px 15px;
133
+ }*/
134
+
135
+ .sub-wrapper .default-list {
136
+ display: block;
137
+ float: left;
138
+ overflow: hidden;
139
+ width: 180px;
140
+ padding: 0 0 0 1px;
141
+ margin: 0 0 0 1px;
142
+ list-style: none;
143
+ border-left: solid 1px #000;
144
+ }
145
+ .sub-wrapper .default-list li a {
146
+ display: block;
147
+ padding: 10px 15px;
148
+ color: #fff;
149
+ text-decoration: none;
150
+ font-size: 13px;
151
+ }
152
+ .sub-wrapper .default-list li span {
153
+ background-color: #252525;
154
+ border-top: 1px solid #131313;
155
+ border-bottom: 1px solid #353535;
156
+ padding: 10px 15px;
157
+ font-size: 13px;
158
+ display: block;
159
+ color: #952c9e;
160
+ }
161
+ .sub-wrapper .default-list li a:hover {
162
+ background-color: #000;
163
+ }
164
+ /* End main panel */
@@ -349,7 +349,7 @@ input[disabled].button.gray {
349
349
  display: block;
350
350
  float: left;
351
351
  overflow: hidden;
352
- width: 241px;
352
+ width: 241px !important;
353
353
  padding: 0;
354
354
  margin: 0;
355
355
  list-style: none;
@@ -360,16 +360,16 @@ input[disabled].button.gray {
360
360
  }
361
361
  /* new css code */
362
362
  .sub-wrapper .main-list li {
363
- font-weight:bold;
364
- text-shadow:#000 1px 2px 0;
363
+ font-weight:bold !important;
364
+ text-shadow:#000 1px 2px 0 !important;
365
365
  }
366
366
  .sub-wrapper .main-list li a {
367
367
  display: block;
368
368
  height:27px;
369
- padding: 10px 30px 0 65px;
369
+ padding: 10px 30px 0 65px !important;
370
370
  color: #fff;
371
371
  text-decoration: none;
372
- font-size: 15px;
372
+ font-size: 15px !important;
373
373
  font-weight:normal;
374
374
  text-shadow:none;
375
375
  }
@@ -378,8 +378,8 @@ input[disabled].button.gray {
378
378
  background-color: #252525 !important;
379
379
  border-top: 1px solid #131313;
380
380
  border-bottom: 1px solid #353535;
381
- padding: 9px 30px 9px 65px;
382
- font-size: 15px;
381
+ padding: 9px 30px 9px 65px !important;
382
+ font-size: 15px !important;
383
383
  display: block;
384
384
  /* color: #952c9e;*/
385
385
  }
@@ -8,10 +8,6 @@
8
8
  <title><%= t('manage.page_title') %></title>
9
9
 
10
10
  <%= stylesheet_link_tag "sunrise/application" %>
11
- <!--[if lt IE 8]>
12
- <link rel="stylesheet" href="/assets/sunrise/ie.css" type="text/css" media="screen, projection" />
13
- <![endif]-->
14
-
15
11
  <%= javascript_include_tag "sunrise/application" %>
16
12
  </head>
17
13
  <body>
@@ -0,0 +1,5 @@
1
+ <div class="but-holder">
2
+ <div class="act-but">
3
+ <%= link_to image_tag('sunrise/empty.gif'), mass_destroy_path, :class => 'but-container del disabled', :title => 'Delete', :"data-confirm-message" => t('manage.confirm_mass_delete'), :"data-editable" => 'destroy' %>
4
+ </div>
5
+ </div>
@@ -0,0 +1,5 @@
1
+ <div class="but-holder">
2
+ <div class="act-but">
3
+ <%= link_to image_tag('sunrise/empty.gif'), edit_path(model.parent_hash.merge(:id => 0)), :class => 'but-container edit disabled', :title => 'Edit', :"data-editable" => 'edit' %>
4
+ </div>
5
+ </div>
@@ -0,0 +1,5 @@
1
+ <div class="but-holder">
2
+ <div class="act-but">
3
+ <%= link_to image_tag('sunrise/empty.gif'), export_path(:format => :csv), :class => 'but-container opt', :title => 'Export' %>
4
+ </div>
5
+ </div>
@@ -0,0 +1,5 @@
1
+ <div class="but-holder">
2
+ <div class="act-but">
3
+ <%= link_to image_tag('sunrise/empty.gif'), new_path(model.parent_hash), :class => 'but-container add', :title => 'Add' %>
4
+ </div>
5
+ </div>
@@ -0,0 +1,20 @@
1
+ <div class="but-holder">
2
+ <div class="act-but">
3
+ <%= link_to image_tag('sunrise/empty.gif'), export_path(:format => :json), :class => 'but-container sort', :title => 'Sort', :id => 'sort-button', :"data-save_title" => 'Save', :"data-cancel_title" => 'Cancel', :"data-url" => sort_path(:format => :json) %>
4
+
5
+ <script type="text/javascript">
6
+ $(document).ready(function(){
7
+ $('#sort-button').sort_dialog();
8
+ });
9
+ </script>
10
+
11
+ <script id="sort-template" type="text/x-jquery-tmpl">
12
+ <div class="sort-item" data-record-id="${id}">
13
+ <div class="sort-inner">
14
+ <div class="numb">${<%= abstract_model.sort_column %>}</div>
15
+ <div>${<%= model.config.object_label_method %>}</div>
16
+ </div>
17
+ </div>
18
+ </script>
19
+ </div>
20
+ </div>
@@ -1,23 +1,18 @@
1
1
  <div class="black-line">
2
- <div class="rel-holder">
3
- <div class="menu-holder">
4
- <ul class="main-menu">
5
- <li>
6
- <%= link_to index_path(:model_name => "structures"), :class => "ddmenu", :rel => "structures" do %>
7
- <span class="modul">
8
- <span class="arr"><%= t 'manage.menu.title' %></span>
9
- </span>
10
- <% end %>
11
- </li>
12
- <li>
13
- <%= link_to index_path(:model_name => "structures"), :class => "ddmenu", :rel => "actions" do %>
14
- <span class="create">
15
- <span class="arr"><%= t 'manage.menu.actions' %></span>
16
- </span>
17
- <% end %>
18
- </li>
19
- </ul>
20
- <ul class="main-menu right">
2
+ <div class="rel-holder">
3
+ <div class="menu-holder">
4
+ <ul class="main-menu">
5
+ <% Sunrise::Config.nav.each do |key, value| %>
6
+ <li>
7
+ <%= link_to "##{key}", :class => "ddmenu", :rel => key do -%>
8
+ <%= content_tag(:span, :class => key) do -%>
9
+ <span class="arr"><%= t key, :scope => [:manage, :menu, :panel] %></span>
10
+ <% end -%>
11
+ <% end -%>
12
+ </li>
13
+ <% end -%>
14
+ </ul>
15
+ <ul class="main-menu right">
21
16
  <li><%= link_to t('manage.go_site'), main_app.root_path, :class => "watch" %></li>
22
17
  <li>
23
18
  <%= link_to index_path(:model_name => "users"), :class => "ddmenu", :rel => "user" do %>
@@ -26,37 +21,25 @@
26
21
  </span>
27
22
  <% end %>
28
23
  </li>
29
- <!--<li>
30
- <a href="#" class="minimize"><img src="images/top_hide.png" /></a>
31
- </li>-->
24
+ <!--<li><a href="#" class="minimize"><img src="images/top_hide.png" /></a></li>-->
32
25
  </ul>
33
- </div>
34
-
35
- <div id="structures-container" class="sub-wrapper modul" style="display: none;">
36
- <div class="sub-inner">
37
- <ul class="main-list">
38
- <% Sunrise::Config.nav[:main].each do |item| %>
39
- <% if can? :read, item.name, :context => :sunrise %>
40
- <li><%= link_to_unless_current_span item.title, item.url, item.html_options %></li>
41
- <% end %>
42
- <% end %>
43
- </ul>
44
- </div>
45
- </div>
46
-
47
- <div id="actions-container" class="sub-wrapper create" style="display: none">
48
- <div class="sub-inner">
49
- <ul class="inner-list">
50
- <% Sunrise::Config.nav[:creates].each do |item| %>
51
- <% if can? :create, item.name, :context => :sunrise %>
52
- <li><%= link_to_unless_current_span item.title, item.url, item.html_options %></li>
53
- <% end %>
54
- <% end %>
55
- </ul>
56
- </div>
57
26
  </div>
58
-
59
- <div id="user-container" class="sub-wrapper user" style="display: none;">
27
+
28
+ <% Sunrise::Config.nav.each do |key, value| -%>
29
+ <%= content_tag(:div, :id => "#{key}-container", :class => ["sub-wrapper", key], :style => "display: none;") do -%>
30
+ <div class="sub-inner">
31
+ <%= content_tag(:ul, :class => ["#{key}-list", "default-list"]) do -%>
32
+ <% value.each do |item| %>
33
+ <% if can? :read, item.name, :context => :sunrise %>
34
+ <li><%= link_to_unless_current_span item.title, item.url, item.html_options %></li>
35
+ <% end %>
36
+ <% end %>
37
+ <% end -%>
38
+ </div>
39
+ <% end -%>
40
+ <% end -%>
41
+
42
+ <div id="user-container" class="sub-wrapper user" style="display: none;">
60
43
  <div class="sub-inner">
61
44
  <ul class="inner-list">
62
45
  <% if can? :edit, current_user, :context => :sunrise %>
@@ -67,5 +50,5 @@
67
50
  </ul>
68
51
  </div>
69
52
  </div>
70
- </div>
53
+ </div>
71
54
  </div>
@@ -1,51 +1,13 @@
1
1
  <div class="top-line-holder">
2
- <div class="act-buttons-wrapper">
3
- <div class="but-holder"><div class="check"><input type="checkbox" /></div></div>
2
+ <div class="act-buttons-wrapper">
3
+ <div class="but-holder"><div class="check"><input type="checkbox" /></div></div>
4
4
 
5
- <!--<div class="but-holder"><a href="#" class="del"><img src="images/empty.gif" /></a></div>
6
- <div class="but-holder disabled"><span class="edit"><img src="images/empty.gif" /></span></div>
7
- <div class="but-holder"><a href="#" class="add"><img src="images/empty.gif" /></a></div>
8
- <div class="but-holder"><a href="#" class="opt"><img src="images/empty.gif" /></a></div>-->
9
-
10
- <div class="but-holder">
11
- <div class="act-but">
12
- <%= link_to image_tag('sunrise/empty.gif'), mass_destroy_path, :class => 'but-container del disabled', :title => 'Delete', :"data-confirm-message" => t('manage.confirm_mass_delete'), :"data-editable" => 'destroy' %>
13
- </div>
14
- </div>
15
- <div class="but-holder">
16
- <div class="act-but">
17
- <%= link_to image_tag('sunrise/empty.gif'), edit_path(abstract_model.parent_hash.merge(:id => 0)), :class => 'but-container edit disabled', :title => 'Edit', :"data-editable" => 'edit' %>
18
- </div>
19
- </div>
20
- <div class="but-holder">
21
- <div class="act-but">
22
- <%= link_to image_tag('sunrise/empty.gif'), new_path(abstract_model.parent_hash), :class => 'but-container add', :title => 'Add' %>
23
- </div>
24
- </div>
25
- <div class="but-holder">
26
- <div class="act-but">
27
- <%= link_to image_tag('sunrise/empty.gif'), export_path(:format => :json), :class => 'but-container sort', :title => 'Sort', :id => 'sort-button', :"data-save_title" => 'Save', :"data-cancel_title" => 'Cancel', :"data-url" => sort_path(:format => :json) %>
28
-
29
- <script type="text/javascript">
30
- $(document).ready(function(){
31
- $('#sort-button').sort_dialog();
32
- });
33
- </script>
34
-
35
- <script id="sort-template" type="text/x-jquery-tmpl">
36
- <div class="sort-item" data-record-id="${id}">
37
- <div class="sort-inner">
38
- <div class="numb">${<%= abstract_model.sort_column %>}</div>
39
- <div>${<%= abstract_model.config.object_label_method %>}</div>
40
- </div>
41
- </div>
42
- </script>
43
- </div>
44
- </div>
45
- <div class="but-holder">
46
- <div class="act-but">
47
- <%= link_to image_tag('sunrise/empty.gif'), export_path(:format => :csv), :class => 'but-container opt', :title => 'Export' %>
48
- </div>
49
- </div>
50
- </div>
5
+ <% unless abstract_model.without_list? %>
6
+ <% abstract_model.list.buttons.each do |name| %>
7
+ <% if can? name, abstract_model.model, :context => :sunrise %>
8
+ <%= render :partial => "sunrise/manager/buttons/#{name}", :locals => {:model => abstract_model} %>
9
+ <% end -%>
10
+ <% end -%>
11
+ <% end -%>
12
+ </div>
51
13
  </div>
@@ -115,6 +115,9 @@ en:
115
115
  tracks: "Music"
116
116
  wallpapers: "Wallpaper"
117
117
  reviews: "vote"
118
+ panel:
119
+ main: "Structure"
120
+ creates: "Create"
118
121
 
119
122
  settings:
120
123
  title: "Settings"
@@ -129,6 +129,10 @@ ru:
129
129
  creates:
130
130
  structures: "Раздел"
131
131
  users: "Пользователя"
132
+
133
+ panel:
134
+ main: "Разделы и модули"
135
+ creates: "Создать"
132
136
 
133
137
  settings:
134
138
  title: "Настройки"
@@ -129,6 +129,10 @@ uk:
129
129
  creates:
130
130
  structures: "Розділ"
131
131
  users: "Користувача"
132
+
133
+ panel:
134
+ main: "Розділи та модулі"
135
+ creates: "Створити"
132
136
 
133
137
  settings:
134
138
  title: "Налаштування"
@@ -2,15 +2,14 @@
2
2
 
3
3
  def insert_user
4
4
  User.truncate!
5
- Role.truncate!
6
5
  password = Rails.env.production? ? Devise.friendly_token : (1..9).to_a.join
7
6
 
8
7
  admin = User.new do |u|
9
8
  u.name = "Administrator"
10
- u.email = 'dev@example.com'
9
+ u.email = 'dev@fodojo.com'
11
10
  u.password = password
12
11
  u.password_confirmation = password
13
- u.login = = 'admin' if u.respond_to?(:login)
12
+ u.login = 'admin' if u.respond_to?(:login)
14
13
  u.role_type = RoleType.admin
15
14
  end
16
15
 
@@ -32,6 +32,11 @@ module Sunrise
32
32
  register_instance_option(:preview) do
33
33
  false
34
34
  end
35
+
36
+ # List of toolbar buttons
37
+ register_instance_option(:buttons) do
38
+ Sunrise::Config.default_toolbar_buttons
39
+ end
35
40
 
36
41
  def preview_for(record)
37
42
  if preview.respond_to?(:call)
@@ -41,6 +41,10 @@ module Sunrise
41
41
  # more info here: https://github.com/norman/babosa
42
42
  mattr_accessor :transliteration
43
43
  @@transliteration = :russian
44
+
45
+ # Set list toolbar buttons
46
+ mattr_accessor :default_toolbar_buttons
47
+ @@default_toolbar_buttons = [:delete, :edit, :new, :sort, :export]
44
48
 
45
49
  def self.scoped_views?
46
50
  @@scoped_views === true
@@ -1,3 +1,3 @@
1
1
  module Sunrise
2
- VERSION = "0.5.0.rc2".freeze
2
+ VERSION = "0.5.0.rc3".freeze
3
3
  end
@@ -3,7 +3,9 @@ class SunrisePost < Sunrise::AbstractModel
3
3
 
4
4
  association :structure
5
5
 
6
- list :thumbs do
6
+ list :thumbs do
7
+ buttons [:new, :edit, :delete, :sort]
8
+
7
9
  field :title
8
10
  field :updated_at
9
11
  field :id
@@ -2,6 +2,10 @@ require File.expand_path('../boot', __FILE__)
2
2
 
3
3
  require 'rails/all'
4
4
 
5
+ unless defined?(SUNRISE_ORM)
6
+ SUNRISE_ORM = (ENV["SUNRISE_ORM"] || :active_record).to_sym
7
+ end
8
+
5
9
  if defined?(Bundler)
6
10
  # If you precompile assets before deploying to production, use this line
7
11
  Bundler.require(*Rails.groups(:assets => %w(development test)))