kitsune 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rake'
2
2
 
3
3
  gem_spec = Gem::Specification.new do |gem_spec|
4
4
  gem_spec.name = "kitsune"
5
- gem_spec.version = "0.0.6"
5
+ gem_spec.version = "0.0.7"
6
6
  gem_spec.summary = "Integrated Rails Content Management System."
7
7
  gem_spec.email = "matt@toastyapps.com"
8
8
  gem_spec.homepage = "http://github.com/toastyapps/kitsune"
@@ -14,16 +14,22 @@
14
14
  <td><%= truncate(sanitize(model.display_for(record, column.name).to_s), :length => 20) %></td>
15
15
  <% end %>
16
16
  <td>
17
- <% if parent %>
18
- <%= link_to 'Edit', :controller => 'admin/kitsune/records', :action => :edit, :model_id => model.object_class, :id => record.id, (parent.class.to_s.underscore+'_id').to_sym => parent.id %>
19
- <% else %>
20
- <%= link_to 'Edit', :controller => 'admin/kitsune/records', :action => :edit, :model_id => model.object_class, :id => record.id %>
21
- <% end %>
22
- -
23
- <% if parent %>
24
- <%= link_to('Delete', url_for(:controller => 'admin/kitsune/records', :model_id => model.object_class, :id => record.id, :action => :destroy, :redirect => (parent.class.to_s.underscore+'_id'), :redirect_id => parent.id), :method => :delete, :confirm => "Are you sure?") %>
25
- <% else %>
26
- <%= link_to('Delete', url_for(:controller => 'admin/kitsune/records', :model_id => model.object_class, :id => record.id, :action => :destroy), :method => :delete, :confirm => "Are you sure?") %>
17
+ <% unless model.disabled?(:edit) %>
18
+ <% if parent %>
19
+ <%= link_to 'Edit', :controller => 'admin/kitsune/records', :action => :edit, :model_id => model.object_class, :id => record.id, (parent.class.to_s.underscore+'_id').to_sym => parent.id %>
20
+ <% else %>
21
+ <%= link_to 'Edit', :controller => 'admin/kitsune/records', :action => :edit, :model_id => model.object_class, :id => record.id %>
22
+ <% end %>
23
+ <% end %>
24
+ <% unless model.disabled?(:edit) || model.disabled?(:delete) %>
25
+ -
26
+ <% end %>
27
+ <% unless model.disabled?(:delete) %>
28
+ <% if parent %>
29
+ <%= link_to('Delete', url_for(:controller => 'admin/kitsune/records', :model_id => model.object_class, :id => record.id, :action => :destroy, :redirect => (parent.class.to_s.underscore+'_id'), :redirect_id => parent.id), :method => :delete, :confirm => "Are you sure?") %>
30
+ <% else %>
31
+ <%= link_to('Delete', url_for(:controller => 'admin/kitsune/records', :model_id => model.object_class, :id => record.id, :action => :destroy), :method => :delete, :confirm => "Are you sure?") %>
32
+ <% end %>
27
33
  <% end %>
28
34
  </td>
29
35
  </tr>
@@ -1,8 +1,10 @@
1
1
  <div id='kitsune_record_header'>
2
2
  <h2><%= @model.admin_name %></h2>
3
- <div id='menu'>
4
- <%= link_to "New #{params[:id]}", :controller => 'admin/kitsune/records', :action => :new, :model_id => params[:model_id] %>
5
- </div>
3
+ <% unless @model.disabled?(:new) %>
4
+ <div id='menu'>
5
+ <%= link_to "New #{params[:id]}", :controller => 'admin/kitsune/records', :action => :new, :model_id => params[:model_id] %>
6
+ </div>
7
+ <% end %>
6
8
  </div>
7
9
  <% @model.tabs.each do |key, value|%>
8
10
  <%= link_to key, value %>
@@ -13,7 +13,8 @@ module Kitsune
13
13
  :reflections => {},
14
14
  :fields => {},
15
15
  :tabs => {},
16
- :is_sti => false
16
+ :is_sti => false,
17
+ :disabled => []
17
18
  }
18
19
  end
19
20
  end
@@ -28,4 +29,4 @@ module Kitsune
28
29
  self.kitsune_admin[:no_admin] = true
29
30
  end
30
31
  end
31
- end
32
+ end
@@ -16,6 +16,10 @@ module Kitsune
16
16
  @resource.kitsune_admin[:name] = name
17
17
  end
18
18
 
19
+ def no_menu
20
+ no_admin
21
+ end
22
+
19
23
  def no_admin
20
24
  @resource.kitsune_admin[:no_admin] = true
21
25
  end
@@ -35,6 +39,12 @@ module Kitsune
35
39
  def columns(type = nil)
36
40
  @resource.columns
37
41
  end
42
+
43
+ def disable(*types)
44
+ types.each do |type|
45
+ @resource.kitsune_admin[:disabled] << type.to_sym
46
+ end
47
+ end
38
48
 
39
49
  def sortable(*fields)
40
50
  @resource.kitsune_admin[:sortable] ||= []
@@ -16,6 +16,10 @@ module Kitsune
16
16
  def category
17
17
  kitsune_admin[:category] || nil
18
18
  end
19
+
20
+ def disabled?(type)
21
+ kitsune_admin[:disabled].include?(type.to_sym)
22
+ end
19
23
 
20
24
  def is_sti?
21
25
  kitsune_admin[:is_sti]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitsune
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Mongeau <matt@toastyapps.com>