rademade_admin 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e967c4945eda7534ef2e9ed32ae11b9686e16dc5
4
- data.tar.gz: 68134738ae0f819c71c11abde50944e0b70d1da9
3
+ metadata.gz: 9b5a2cb3531638de5873ab10f39c9d89b5628d6e
4
+ data.tar.gz: 377c15c9e31e321d6fac8e2994c2b88acfebe8c3
5
5
  SHA512:
6
- metadata.gz: 93b797e63ff62a8c46185834188b9108e88e5c8a0a2317e114c021a83535c9b9fa61d012846b0386e5f7cd1e0b869dc8330117aad65a76e1c012d818eb35587c
7
- data.tar.gz: c745f46bed20435c396c68d6be3dd3c09d4c4c5493ee4eb603cec0686f1f52efaf8a6da8b7d2feedab2d90329f70e0991b9947e6a36b88abfdaacb7849838f11
6
+ metadata.gz: 3fbfa9b7ec35b66ea9df3a88bfff40ce06ad34940d935b2768ef33e08b5317292eb702c71ac93085b9bb0be8446dd6cf3a6841cfc4f229fcea40b3541fc3cf67
7
+ data.tar.gz: 57d1a457a2b782f2626e9fd4f0378cc0d018655b8ebfba0df2fbef067b9b8d1abd3d78eea98f2d57bfcd9a1dae26c3dbbed801690038c59616432f884f9311b0
@@ -1,15 +1,16 @@
1
- li class=('menu-box' + (@is_active ? ' active' : ''))
1
+ - if @uri
2
+ li class=('menu-box' + (@is_active ? ' active' : ''))
2
3
 
3
- .pointer
4
- .arrow
5
- .arrow_border
4
+ .pointer
5
+ .arrow
6
+ .arrow_border
6
7
 
7
- a href="#{@uri}" class=('menu-link' + (@has_sub_items ? ' dropdown-toggle' : ''))
8
- i(class="#{@ico_class}")
9
- span #{@name}
8
+ a href="#{@uri}" class=('menu-link' + (@has_sub_items ? ' dropdown-toggle' : ''))
9
+ i(class="#{@ico_class}")
10
+ span #{@name}
10
11
 
11
- - if @has_sub_items
12
- span.caret
12
+ - if @has_sub_items
13
+ span.caret
13
14
 
14
- - if @has_sub_items
15
- =render_cell(:menu, :sub_items, @sub_items)
15
+ - if @has_sub_items
16
+ =render_cell(:menu, :sub_items, @sub_items)
@@ -1,4 +1,5 @@
1
- li class=('menu-box' + (@is_active ? ' active' : ''))
2
- a.menu-link(href="#{@uri}") #{@name}
3
- - if @has_sub_items
4
- =render_cell(:menu, :sub_items, @sub_items)
1
+ - if @uri
2
+ li class=('menu-box' + (@is_active ? ' active' : ''))
3
+ a.menu-link(href="#{@uri}") #{@name}
4
+ - if @has_sub_items
5
+ =render_cell(:menu, :sub_items, @sub_items)
@@ -40,5 +40,9 @@ module RademadeAdmin
40
40
  @current_user.is_a? RademadeAdmin.user_class and @current_user.admin?
41
41
  end
42
42
 
43
+ def current_ability
44
+ @current_ability ||= ::RademadeAdmin::Ability.new(@current_user)
45
+ end
46
+
43
47
  end
44
48
  end
@@ -2,9 +2,5 @@
2
2
  module RademadeAdmin
3
3
  class ApplicationController < ActionController::Base
4
4
 
5
- def current_ability
6
- @current_ability ||= RademadeAdmin::Ability.new(@current_user)
7
- end
8
-
9
5
  end
10
6
  end
@@ -20,9 +20,9 @@ module RademadeAdmin
20
20
  saver = RademadeAdmin::Saver.new(model_info, params)
21
21
  saver.create_model
22
22
  saver.save_data
23
- success_insert( saver.item )
23
+ success_insert saver.item
24
24
  rescue Exception => e
25
- render_errors e.record.errors
25
+ render_record_errors e
26
26
  end
27
27
 
28
28
  def update
@@ -30,9 +30,9 @@ module RademadeAdmin
30
30
  saver = RademadeAdmin::Saver.new(model_info, params)
31
31
  saver.find_model
32
32
  saver.save_data
33
- success_update( saver.item )
33
+ success_update saver.item
34
34
  rescue Exception => e
35
- render_errors e.record.errors
35
+ render_record_errors e
36
36
  end
37
37
 
38
38
  def destroy
@@ -163,5 +163,14 @@ module RademadeAdmin
163
163
  def additional_options
164
164
  MenuCell.current_model = model
165
165
  end
166
+
167
+ def render_record_errors(e)
168
+ if e.respond_to? :record
169
+ render_errors e.record.errors
170
+ else
171
+ render_errors e.message
172
+ end
173
+ end
174
+
166
175
  end
167
176
  end
@@ -1,3 +1,3 @@
1
1
  <%= f.button :submit, :class => 'blue-btn' %>
2
2
  <span class="btn-sep"><%= t('rademade_admin.or') %></span>
3
- <%= link_to t('rademade_admin.cancel'), admin_list_uri(@model), :class => 'cancel-btn' %>
3
+ <%= link_to t('rademade_admin.cancel'), admin_list_uri(@model) || '', :class => 'cancel-btn' %>
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module RademadeAdmin
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rademade_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladislav Melanitskiy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-12-07 00:00:00.000000000 Z
13
+ date: 2014-12-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails