rails_admin_spice 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = RailsAdminSpice
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'RailsAdminSpice'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
@@ -0,0 +1,12 @@
1
+
2
+ en:
3
+ admin:
4
+ actions:
5
+ approve:
6
+ title: "Approve"
7
+ menu: "Approve %{model_label}"
8
+ breadcrumb: "Approve"
9
+ link: "Approve"
10
+ bulk_link: "Approve selected %{model_label_plural}"
11
+ done: "Approved %{model_label} '%{object_label}'"
12
+ not_available: "Already approved %{model_label} '%{object_label}'"
@@ -0,0 +1,36 @@
1
+ module RailsAdmin
2
+ module Config
3
+ module Actions
4
+ class Approve < RailsAdmin::Config::Actions::Base
5
+ RailsAdmin::Config::Actions.register(self)
6
+
7
+ register_instance_option(:visible?) do
8
+ authorized? and bindings[:object].respond_to? :state_cd and bindings[:object].state_cd == 0
9
+ end
10
+
11
+ register_instance_option(:member) { true }
12
+ register_instance_option(:link_icon) { 'icon-check' }
13
+ register_instance_option(:pjax?) { false }
14
+
15
+ register_instance_option :controller do
16
+ Proc.new do
17
+
18
+ if @object.state_cd == 0
19
+ @object.update_attribute(:state_cd, 1)
20
+ flash[:notice] = t 'admin.actions.approve.done',
21
+ model_label:@abstract_model.model_name,
22
+ object_label: @object.send(@model_config.object_label_method)
23
+ else
24
+ flash[:error] = t 'admin.actions.approve.not_available',
25
+ model_label:@abstract_model.model_name,
26
+ object_label: @object.send(@model_config.object_label_method)
27
+ end
28
+
29
+ redirect_to back_or_index
30
+ end
31
+ end
32
+
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,4 @@
1
+ module RailsAdminSpice
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module RailsAdminSpice
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,8 @@
1
+ require 'rails_admin_spice/engine'
2
+ require 'rails_admin/config/actions'
3
+ require 'rails_admin/config/actions/base'
4
+
5
+ Dir[RailsAdminSpice::Engine.root.join("lib/rails_admin_spice/actions/**/*.rb")].each { |f| require f }
6
+
7
+ module RailsAdminSpice
8
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_admin_spice
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Egor Kalinichev
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-08-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.11
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.11
30
+ - !ruby/object:Gem::Dependency
31
+ name: rails_admin
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.4.9
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.4.9
46
+ description: Set of useful add-ons to Rails Admin panel
47
+ email:
48
+ - egork92@gmail.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - config/locales/spice.yml
54
+ - lib/rails_admin_spice/engine.rb
55
+ - lib/rails_admin_spice/version.rb
56
+ - lib/rails_admin_spice/actions/approve.rb
57
+ - lib/rails_admin_spice.rb
58
+ - MIT-LICENSE
59
+ - Rakefile
60
+ - README.rdoc
61
+ homepage: https://github.com/jatt/rails_admin_spice
62
+ licenses: []
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 1.8.25
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: Set of useful add-ons to Rails Admin panel
85
+ test_files: []