sunrise-scaffold 0.1.5 → 0.2.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/Rakefile +0 -20
- data/lib/generators/sunrise/scaffold/manage_generator.rb +2 -2
- data/lib/generators/sunrise/scaffold/templates/multiplay/controller.rb +4 -9
- data/lib/generators/sunrise/scaffold/templates/multiplay/spec/controller_spec.rb +96 -0
- data/lib/generators/sunrise/scaffold/templates/multiplay/views/index.html.erb +5 -1
- data/lib/generators/sunrise/scaffold/templates/multiplay/views/item.html.erb +7 -2
- data/lib/generators/sunrise/scaffold/templates/multiplay/views/model_filter.html.erb +11 -9
- data/lib/generators/sunrise/scaffold/templates/single/controller.rb +4 -9
- data/lib/generators/sunrise/scaffold/templates/single/spec/controller_spec.rb +94 -0
- data/lib/generators/sunrise/scaffold/templates/single/views/index.html.erb +7 -1
- data/lib/generators/sunrise/scaffold/templates/single/views/item.html.erb +8 -3
- data/lib/generators/sunrise/scaffold/templates/single/views/model_filter.html.erb +12 -11
- data/lib/sunrise/scaffold/version.rb +1 -1
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/comment.rb +3 -0
- data/test/dummy/app/models/post.rb +3 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +45 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +22 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +26 -0
- data/test/dummy/config/environments/production.rb +49 -0
- data/test/dummy/config/environments/test.rb +35 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/migrate/20110722084440_create_posts.rb +14 -0
- data/test/dummy/db/migrate/20110722085934_create_comments.rb +15 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -0
- data/test/dummy/log/production.log +0 -0
- data/test/dummy/log/server.log +0 -0
- data/test/dummy/log/test.log +135 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/javascripts/application.js +2 -0
- data/test/dummy/public/javascripts/controls.js +965 -0
- data/test/dummy/public/javascripts/dragdrop.js +974 -0
- data/test/dummy/public/javascripts/effects.js +1123 -0
- data/test/dummy/public/javascripts/prototype.js +6001 -0
- data/test/dummy/public/javascripts/rails.js +191 -0
- data/test/dummy/script/rails +6 -0
- data/test/generators/manage_generator_test.rb +32 -0
- data/test/integration/navigation_test.rb +7 -0
- data/test/support/integration_case.rb +4 -0
- data/test/test_helper.rb +29 -0
- data/test/tmp/app/controllers/manage/posts_controller.rb +26 -0
- data/test/tmp/app/helpers/manage/posts_helper.rb +2 -0
- data/test/tmp/app/views/manage/posts/_form.html.erb +18 -0
- data/test/tmp/app/views/manage/posts/_model_filter.html.erb +34 -0
- data/test/tmp/app/views/manage/posts/_post.html.erb +32 -0
- data/test/tmp/app/views/manage/posts/edit.html.erb +6 -0
- data/test/tmp/app/views/manage/posts/index.html.erb +36 -0
- data/test/tmp/app/views/manage/posts/new.html.erb +6 -0
- data/test/tmp/app/views/manage/posts/show.html.erb +29 -0
- data/test/tmp/spec/controllers/manage/posts_controller_spec.rb +94 -0
- metadata +137 -35
- data/Gemfile.lock +0 -75
- data/lib/generators/sunrise/scaffold/templates/multiplay/functional_test.rb +0 -103
- data/lib/generators/sunrise/scaffold/templates/single/functional_test.rb +0 -98
data/Rakefile
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
require 'rake'
|
3
3
|
require 'rake/testtask'
|
4
4
|
require 'rake/rdoctask'
|
5
|
-
require File.join(File.dirname(__FILE__), 'lib', 'sunrise', 'scaffold', 'version')
|
6
5
|
|
7
6
|
desc 'Default: run unit tests.'
|
8
7
|
task :default => :test
|
@@ -23,22 +22,3 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
23
22
|
rdoc.rdoc_files.include('README')
|
24
23
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
25
24
|
end
|
26
|
-
|
27
|
-
begin
|
28
|
-
require 'jeweler'
|
29
|
-
Jeweler::Tasks.new do |s|
|
30
|
-
s.name = "sunrise-scaffold"
|
31
|
-
s.version = Sunrise::Scaffold::VERSION.dup
|
32
|
-
s.summary = "Rails CMS"
|
33
|
-
s.description = "Sunrise is a Aimbulance CMS"
|
34
|
-
s.email = "galeta.igor@gmail.com"
|
35
|
-
s.homepage = "https://github.com/galetahub/sunrise-scaffold"
|
36
|
-
s.authors = ["Igor Galeta", "Pavlo Galeta"]
|
37
|
-
s.files = FileList["[A-Z]*", "lib/**/*"]
|
38
|
-
s.extra_rdoc_files = FileList["[A-Z]*"] - %w(Gemfile Rakefile)
|
39
|
-
end
|
40
|
-
|
41
|
-
Jeweler::GemcutterTasks.new
|
42
|
-
rescue LoadError
|
43
|
-
puts "Jeweler not available. Install it with: gem install jeweler"
|
44
|
-
end
|
@@ -22,8 +22,8 @@ module Sunrise
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def create_tests_files
|
25
|
-
template "#{generator_dir}/
|
26
|
-
File.join('
|
25
|
+
template "#{generator_dir}/spec/controller_spec.rb",
|
26
|
+
File.join('spec/controllers', manage_path, "#{controller_file_name}_controller_spec.rb")
|
27
27
|
end
|
28
28
|
|
29
29
|
def create_views_files
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class Manage::<%= controller_class_name %>Controller < Manage::BaseController
|
2
2
|
inherit_resources
|
3
|
-
defaults :route_prefix => 'manage'
|
4
3
|
belongs_to :<%= parent_singular_name %>
|
5
4
|
|
6
|
-
before_filter :make_filter, :only=>[:index]
|
7
|
-
|
8
5
|
load_and_authorize_resource :<%= singular_name %>, :through => :<%= parent_singular_name %>
|
9
6
|
|
7
|
+
has_scope :with_title, :as => :title, :only => :index
|
8
|
+
order_by :created_at, :updated_at
|
9
|
+
|
10
10
|
def create
|
11
11
|
create!{ manage_<%= parent_singular_name %>_<%= plural_name %>_path(@<%= parent_singular_name %>.id) }
|
12
12
|
end
|
@@ -26,11 +26,6 @@ class Manage::<%= controller_class_name %>Controller < Manage::BaseController
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def collection
|
29
|
-
@<%= plural_name %> = (@<%= plural_name %> || end_of_association_chain).
|
30
|
-
end
|
31
|
-
|
32
|
-
def make_filter
|
33
|
-
@search = Sunrise::ModelFilter.new(<%= model_name %>, :attributes=>[ <%= model.attributes.keys.map{ |a| ":#{a}" }.join(', ') %> ] )
|
34
|
-
@search.update_attributes(params[:search])
|
29
|
+
@<%= plural_name %> = (@<%= plural_name %> || end_of_association_chain).order(search_filter.order).page(params[:page])
|
35
30
|
end
|
36
31
|
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Manage::<%= controller_class_name %>Controller do
|
4
|
+
render_views
|
5
|
+
|
6
|
+
before(:all) do
|
7
|
+
@<%= parent_singular_name %> = FactoryGirl.create(:<%= parent_singular_name %>)
|
8
|
+
@attrs = FactoryGirl.attributes_for(:<%= singular_name %>, :<%= parent_singular_name %> => @<%= parent_singular_name %>)
|
9
|
+
end
|
10
|
+
|
11
|
+
context "administrator" do
|
12
|
+
login_admin
|
13
|
+
|
14
|
+
it "should render new action" do
|
15
|
+
get :new, :<%= parent_singular_name %>_id => @<%= parent_singular_name %>.id
|
16
|
+
response.should be_success
|
17
|
+
response.should render_template("new")
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should create new <%= singular_name %>" do
|
21
|
+
lambda {
|
22
|
+
post :create, :<%= singular_name %> => @attrs, :<%= parent_singular_name %>_id => @<%= parent_singular_name %>.id
|
23
|
+
}.should change { <%= class_name %>.count }.by(1)
|
24
|
+
end
|
25
|
+
|
26
|
+
context "exists default <%= singular_name %>" do
|
27
|
+
before(:each) do
|
28
|
+
@<%= singular_name %> = <%= model_name %>.create(@attrs)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should render index action" do
|
32
|
+
get :index, :<%= parent_singular_name %>_id => @<%= parent_singular_name %>.id
|
33
|
+
assigns(:<%= parent_singular_name %>).should == @<%= parent_singular_name %>
|
34
|
+
assigns(:<%= plural_name %>).should include(@<%= singular_name %>)
|
35
|
+
response.should render_template('index')
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should render edit action" do
|
39
|
+
controller.should_receive :edit, :<%= parent_singular_name %>_id => @<%= parent_singular_name %>.id
|
40
|
+
get :edit, :id => @<%= singular_name %>.id
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should update <%= singular_name %>" do
|
44
|
+
put :update, :id => @<%= singular_name %>.id, :<%= singular_name %> => @attrs, :<%= parent_singular_name %>_id => @<%= parent_singular_name %>.id
|
45
|
+
assigns(:<%= singular_name %>).should be_valid
|
46
|
+
response.should redirect_to(manage_<%= parent_singular_name %>_<%= plural_name %>_path)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should destroy <%= singular_name %>" do
|
50
|
+
lambda {
|
51
|
+
delete :destroy, :id => @<%= singular_name %>.id
|
52
|
+
}.should change { <%= class_name %>.count }.by(-1)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "anonymous user" do
|
58
|
+
user_logout
|
59
|
+
|
60
|
+
it "should not render index action" do
|
61
|
+
controller.should_not_receive :index
|
62
|
+
get :index, :<%= parent_singular_name %>_id => @<%= parent_singular_name %>.id
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should not render new action" do
|
66
|
+
controller.should_not_receive :new
|
67
|
+
get :new, :<%= parent_singular_name %>_id => @<%= parent_singular_name %>.id
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should not render create action" do
|
71
|
+
controller.should_not_receive :create
|
72
|
+
post :create, :<%= parent_singular_name %>_id => @<%= parent_singular_name %>.id
|
73
|
+
end
|
74
|
+
|
75
|
+
context "with exists <%= singular_name %>" do
|
76
|
+
before(:each) do
|
77
|
+
@<%= singular_name %> = <%= model_name %>.create(@attrs)
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should not render edit action" do
|
81
|
+
controller.should_not_receive :edit
|
82
|
+
get :edit, :id => @<%= singular_name %>.id, :<%= parent_singular_name %>_id => @<%= parent_singular_name %>.id
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should not render update action" do
|
86
|
+
controller.should_not_receive :update
|
87
|
+
put :update, :id => @<%= singular_name %>.id, :<%= parent_singular_name %>_id => @<%= parent_singular_name %>.id
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should not render destroy action" do
|
91
|
+
controller.should_not_receive :destroy
|
92
|
+
delete :destroy, :id => @<%= singular_name %>.id, :<%= parent_singular_name %>_id => @<%= parent_singular_name %>.id
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -6,11 +6,14 @@
|
|
6
6
|
<div class="r-corn">
|
7
7
|
<%%= link_to t('manage.menu.<%= plural_name %>'), manage_<%= parent_singular_name %>_<%= plural_name %>_path(@<%= parent_singular_name %>.id), :class=>"dark-text" %>
|
8
8
|
<div class="act-bl">
|
9
|
-
|
9
|
+
<%% if can? :create, <%= class_name %>, :context => :manage %>
|
10
|
+
<%%= link_to t('manage.add'), new_manage_<%= parent_singular_name %>_<%= singular_name %>_path(@<%= parent_singular_name %>.id), :class=>"create" %>
|
11
|
+
<%% end -%>
|
10
12
|
</div>
|
11
13
|
</div>
|
12
14
|
</div>
|
13
15
|
</div>
|
16
|
+
|
14
17
|
<div id="<%= plural_name %>" class="stage">
|
15
18
|
<%%= render :partial=>"manage/<%= plural_name %>/<%= singular_name %>", :collection=>@<%= plural_name %> %>
|
16
19
|
<%%= paginate @<%= plural_name %>, :theme => 'manage' %>
|
@@ -21,6 +24,7 @@
|
|
21
24
|
Manage.init_collection('<%= plural_name %>', 'dinamic-bl');
|
22
25
|
});
|
23
26
|
</script>
|
27
|
+
|
24
28
|
</div>
|
25
29
|
</div>
|
26
30
|
|
@@ -1,9 +1,13 @@
|
|
1
1
|
<%%= content_tag(:div, :id=>dom_id(<%= singular_name %>), :class=>"dinamic-bl") do %>
|
2
2
|
<div class="act-bl" style="display:none;">
|
3
|
-
|
3
|
+
<%% if can? :update, <%= singular_name %>, :context => :manage %>
|
4
|
+
<%%= link_to manage_icon("edit"), edit_manage_<%= parent_singular_name %>_<%= singular_name %>_path(@<%= parent_singular_name %>.id, <%= singular_name %>.id), :class=>"icons" %>
|
5
|
+
<%% end -%>
|
4
6
|
|
5
|
-
|
7
|
+
<%% if can? :delete, <%= singular_name %>, :context => :manage %>
|
8
|
+
<%%= link_to manage_icon("delete"), manage_<%= parent_singular_name %>_<%= singular_name %>_path(@<%= parent_singular_name %>.id, <%= singular_name %>.id),
|
6
9
|
:method=>:delete, :confirm=>t("manage.confirm_delete"), :class=>"icons" %>
|
10
|
+
<%% end -%>
|
7
11
|
</div>
|
8
12
|
|
9
13
|
<div class="bot-bg">
|
@@ -16,6 +20,7 @@
|
|
16
20
|
<%%= link_to <%= singular_name %>.title, edit_manage_<%= parent_singular_name %>_<%= singular_name %>_path(@<%= parent_singular_name %>.id, <%= singular_name %>.id), :class=>"title" %>
|
17
21
|
</div>
|
18
22
|
</div>
|
23
|
+
<!--<div class="l-block"> ava img </div>-->
|
19
24
|
</div>
|
20
25
|
</div>
|
21
26
|
</div>
|
@@ -2,12 +2,14 @@
|
|
2
2
|
<div class="filt-bl">
|
3
3
|
<%%= link_to_function t('manage.model_filter.title'), "Manage.toggle_element('block_filter')", :class=>"dark-arr" %>
|
4
4
|
|
5
|
+
<%%= t('manage.model_filter.total_count') %>: <%%= @<%= plural_name %>.total_count %>
|
6
|
+
|
5
7
|
<%%= cookie_content_tag(:div, :id=>"block_filter", :class=>"filt") do %>
|
6
|
-
<%%= form_for
|
7
|
-
|
8
|
-
<%%= f.label
|
9
|
-
<%%= f.text_field
|
10
|
-
|
8
|
+
<%%= form_for search_filter, :url=>manage_<%= parent_singular_name %>_<%= plural_name %>_path(@<%= parent_singular_name %>.id), :html=>{:method=>:get} do |f| %>
|
9
|
+
<%% controller.scopes_configuration.each do |key, value| %>
|
10
|
+
<%%= f.label value[:as], t(value[:as], :scope => "activerecord.attributes.<%= singular_name %>") %>
|
11
|
+
<%%= f.text_field value[:as], :class => "text", :name => value[:as] %>
|
12
|
+
<%% end %>
|
11
13
|
|
12
14
|
<div class="buts">
|
13
15
|
<%%= content_tag(:button, :value=>"search", :type=>"submit", :name=>"commit", :class=>"gr cupid-green") do %>
|
@@ -23,10 +25,10 @@
|
|
23
25
|
<label><%%= t('manage.sort') %></label>
|
24
26
|
<div class="select-input"><%%= link_to_function t("<%= plural_name %>.#{@search.order_column}_#{@search.order_type}", :scope => [:manage, :sort_columns], :default => :"#{@search.order_column}_#{@search.order_type}"), "SelectList.toggle(event)", :class=>"corn", :id=>'sort_select' %></div>
|
25
27
|
<div id='sort_select_list' class="select-list" style='display:none;'>
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
<%% controller.orders_configuration.each do |key, value| %>
|
29
|
+
<%%= link_to_sort(t("#{key}_desc", :scope => "manage.<%= plural_name %>.sort"), :name => key, :order_type=>'desc') %>
|
30
|
+
<%%= link_to_sort(t("#{key}_asc", :scope => "manage.<%= plural_name %>.sort"), :name => key, :order_type=>'asc') %>
|
31
|
+
<%% end %>
|
30
32
|
</div>
|
31
33
|
</div>
|
32
34
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
class Manage::<%= controller_class_name %>Controller < Manage::BaseController
|
2
2
|
inherit_resources
|
3
|
-
defaults :route_prefix => 'manage'
|
4
|
-
|
5
|
-
before_filter :make_filter, :only=>[:index]
|
6
3
|
|
7
4
|
load_and_authorize_resource :class => <%= class_name %>
|
8
5
|
|
6
|
+
has_scope :with_title, :as => :title, :only => :index
|
7
|
+
order_by :created_at, :updated_at
|
8
|
+
|
9
9
|
def create
|
10
10
|
create!{ manage_<%= plural_name %>_path }
|
11
11
|
end
|
@@ -21,11 +21,6 @@ class Manage::<%= controller_class_name %>Controller < Manage::BaseController
|
|
21
21
|
protected
|
22
22
|
|
23
23
|
def collection
|
24
|
-
@<%= plural_name %> = (@<%= plural_name %> || end_of_association_chain).
|
25
|
-
end
|
26
|
-
|
27
|
-
def make_filter
|
28
|
-
@search = Sunrise::ModelFilter.new(<%= class_name %>, :attributes=>[ <%= model.attributes.keys.map{ |a| ":#{a}" }.join(', ') %> ] )
|
29
|
-
@search.update_attributes(params[:search])
|
24
|
+
@<%= plural_name %> = (@<%= plural_name %> || end_of_association_chain).order(search_filter.order).page(params[:page])
|
30
25
|
end
|
31
26
|
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Manage::<%= controller_class_name %>Controller do
|
4
|
+
render_views
|
5
|
+
|
6
|
+
context "administrator" do
|
7
|
+
login_admin
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
@attrs = FactoryGirl.attributes_for(:<%= singular_name %>)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should render new action" do
|
14
|
+
get :new
|
15
|
+
response.should be_success
|
16
|
+
response.should render_template("new")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should create new <%= singular_name %>" do
|
20
|
+
lambda {
|
21
|
+
post :create, :<%= singular_name %> => @attrs
|
22
|
+
}.should change { <%= class_name %>.count }.by(1)
|
23
|
+
end
|
24
|
+
|
25
|
+
context "exists default <%= singular_name %>" do
|
26
|
+
before(:each) do
|
27
|
+
@<%= singular_name %> = FactoryGirl.create(:<%= singular_name %>)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should render index action" do
|
31
|
+
get :index
|
32
|
+
assigns(:<%= plural_name %>).should include(@<%= singular_name %>)
|
33
|
+
response.should render_template('index')
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should render edit action" do
|
37
|
+
controller.should_receive :edit
|
38
|
+
get :edit, :id => @<%= singular_name %>.id
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should update <%= singular_name %>" do
|
42
|
+
put :update, :id => @<%= singular_name %>.id, :<%= singular_name %> => @attrs
|
43
|
+
assigns(:<%= singular_name %>).should be_valid
|
44
|
+
response.should redirect_to(manage_<%= plural_name %>_path)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should destroy <%= singular_name %>" do
|
48
|
+
lambda {
|
49
|
+
delete :destroy, :id => @<%= singular_name %>.id
|
50
|
+
}.should change { <%= class_name %>.count }.by(-1)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "anonymous user" do
|
56
|
+
user_logout
|
57
|
+
|
58
|
+
it "should not render index action" do
|
59
|
+
controller.should_not_receive :index
|
60
|
+
get :index
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should not render new action" do
|
64
|
+
controller.should_not_receive :new
|
65
|
+
get :new
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should not render create action" do
|
69
|
+
controller.should_not_receive :create
|
70
|
+
post :create
|
71
|
+
end
|
72
|
+
|
73
|
+
context "with exists <%= singular_name %>" do
|
74
|
+
before(:each) do
|
75
|
+
@<%= singular_name %> = FactoryGirl.create(:<%= singular_name %>)
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should not render edit action" do
|
79
|
+
controller.should_not_receive :edit
|
80
|
+
get :edit, :id => @<%= singular_name %>.id
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should not render update action" do
|
84
|
+
controller.should_not_receive :update
|
85
|
+
put :update, :id => @<%= singular_name %>.id
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should not render destroy action" do
|
89
|
+
controller.should_not_receive :destroy
|
90
|
+
delete :destroy, :id => @<%= singular_name %>.id
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -6,22 +6,28 @@
|
|
6
6
|
<div class="r-corn">
|
7
7
|
<%%= link_to t('manage.menu.<%= plural_name %>'), manage_<%= plural_name %>_path, :class=>"dark-text" %>
|
8
8
|
<div class="act-bl">
|
9
|
-
|
9
|
+
<%% if can? :create, <%= class_name %>, :context => :manage %>
|
10
|
+
<%%= link_to t('manage.add'), new_manage_<%= singular_name %>_path, :class=>"create" %>
|
11
|
+
<%% end -%>
|
10
12
|
</div>
|
11
13
|
</div>
|
12
14
|
</div>
|
13
15
|
</div>
|
16
|
+
|
14
17
|
<div id="<%= plural_name %>" class="stage">
|
15
18
|
<%%= render :partial=>"manage/<%= plural_name %>/<%= singular_name %>", :collection=>@<%= plural_name %> %>
|
16
19
|
<%%= paginate @<%= plural_name %>, :theme => 'manage' %>
|
17
20
|
</div>
|
21
|
+
|
18
22
|
<script type='text/javascript'>
|
19
23
|
$(document).ready(function(){
|
20
24
|
Manage.init_collection('<%= plural_name %>', 'dinamic-bl');
|
21
25
|
});
|
22
26
|
</script>
|
27
|
+
|
23
28
|
</div>
|
24
29
|
</div>
|
30
|
+
|
25
31
|
<div class="right-part">
|
26
32
|
<div class="filter-right">
|
27
33
|
<%%= render :partial=>"manage/<%= plural_name %>/model_filter" %>
|
@@ -1,9 +1,13 @@
|
|
1
1
|
<%%= content_tag(:div, :id=>dom_id(<%= singular_name %>), :class=>"dinamic-bl") do %>
|
2
2
|
<div class="act-bl" style="display:none;">
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
<%% if can? :update, <%= singular_name %>, :context => :manage %>
|
4
|
+
<%%= link_to manage_icon("edit"), edit_manage_<%= singular_name %>_path(:id=><%= singular_name %>.id), :class=>"icons" %>
|
5
|
+
<%% end -%>
|
6
|
+
|
7
|
+
<%% if can? :delete, <%= singular_name %>, :context => :manage %>
|
8
|
+
<%%= link_to manage_icon("delete"), manage_<%= singular_name %>_path(:id=><%= singular_name %>.id),
|
6
9
|
:method=>:delete, :confirm=>t("manage.confirm_delete"), :class=>"icons" %>
|
10
|
+
<%% end -%>
|
7
11
|
</div>
|
8
12
|
|
9
13
|
<div class="bot-bg">
|
@@ -16,6 +20,7 @@
|
|
16
20
|
<%%= link_to <%= singular_name %>.title, edit_manage_<%= singular_name %>_path(:id=><%= singular_name %>.id), :class=>"title" %>
|
17
21
|
</div>
|
18
22
|
</div>
|
23
|
+
<!--<div class="l-block"> ava img </div>-->
|
19
24
|
</div>
|
20
25
|
</div>
|
21
26
|
</div>
|
@@ -2,12 +2,14 @@
|
|
2
2
|
<div class="filt-bl">
|
3
3
|
<%%= link_to_function t('manage.model_filter.title'), "Manage.toggle_element('block_filter')", :class=>"dark-arr" %>
|
4
4
|
|
5
|
+
<%%= t('manage.model_filter.total_count') %>: <%%= @<%= plural_name %>.total_count %>
|
6
|
+
|
5
7
|
<%%= cookie_content_tag(:div, :id=>"block_filter", :class=>"filt") do %>
|
6
|
-
<%%= form_for
|
7
|
-
|
8
|
-
<%%= f.label
|
9
|
-
<%%= f.text_field
|
10
|
-
|
8
|
+
<%%= form_for search_filter, :url => manage_<%= plural_name %>_path, :html => { :method => :get } do |f| %>
|
9
|
+
<%% controller.scopes_configuration.each do |key, value| %>
|
10
|
+
<%%= f.label value[:as], t(value[:as], :scope => "activerecord.attributes.<%= singular_name %>") %>
|
11
|
+
<%%= f.text_field value[:as], :class => "text", :name => value[:as] %>
|
12
|
+
<%% end %>
|
11
13
|
|
12
14
|
<div class="buts">
|
13
15
|
<%%= content_tag(:button, :value=>"search", :type=>"submit", :name=>"commit", :class=>"gr cupid-green") do %>
|
@@ -21,13 +23,12 @@
|
|
21
23
|
</div>
|
22
24
|
<div class="sort">
|
23
25
|
<label><%%= t('manage.sort') %></label>
|
24
|
-
<div class="select-input"><%%= link_to_function t(
|
26
|
+
<div class="select-input"><%%= link_to_function t(search_filter.current_order, :scope => "manage.<%= plural_name %>.sort"), "SelectList.toggle(event)", :class=>"corn", :id=>'sort_select' %></div>
|
25
27
|
<div id='sort_select_list' class="select-list" style='display:none;'>
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
<%% controller.orders_configuration.each do |key, value| %>
|
29
|
+
<%%= link_to_sort(t("#{key}_desc", :scope => "manage.<%= plural_name %>.sort"), :name => key, :order_type=>'desc') %>
|
30
|
+
<%%= link_to_sort(t("#{key}_asc", :scope => "manage.<%= plural_name %>.sort"), :name => key, :order_type=>'asc') %>
|
31
|
+
<%% end %>
|
30
32
|
</div>
|
31
33
|
</div>
|
32
|
-
|
33
34
|
</div>
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require File.expand_path('../config/application', __FILE__)
|
5
|
+
require 'rake'
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "active_model/railtie"
|
4
|
+
require "active_record/railtie"
|
5
|
+
require "action_controller/railtie"
|
6
|
+
require "action_view/railtie"
|
7
|
+
require "action_mailer/railtie"
|
8
|
+
|
9
|
+
Bundler.require
|
10
|
+
require "sunrise/scaffold"
|
11
|
+
|
12
|
+
module Dummy
|
13
|
+
class Application < Rails::Application
|
14
|
+
# Settings in config/environments/* take precedence over those specified here.
|
15
|
+
# Application configuration should go into files in config/initializers
|
16
|
+
# -- all .rb files in that directory are automatically loaded.
|
17
|
+
|
18
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
19
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
20
|
+
|
21
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
22
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
23
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
24
|
+
|
25
|
+
# Activate observers that should always be running.
|
26
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
27
|
+
|
28
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
29
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
30
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
31
|
+
|
32
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
33
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
34
|
+
# config.i18n.default_locale = :de
|
35
|
+
|
36
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
37
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
38
|
+
|
39
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
40
|
+
config.encoding = "utf-8"
|
41
|
+
|
42
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
43
|
+
config.filter_parameters += [:password]
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
development:
|
4
|
+
adapter: sqlite3
|
5
|
+
database: db/development.sqlite3
|
6
|
+
pool: 5
|
7
|
+
timeout: 5000
|
8
|
+
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
10
|
+
# re-generated from your development database when you run "rake".
|
11
|
+
# Do not set this db to the same as development or production.
|
12
|
+
test:
|
13
|
+
adapter: sqlite3
|
14
|
+
database: db/test.sqlite3
|
15
|
+
pool: 5
|
16
|
+
timeout: 5000
|
17
|
+
|
18
|
+
production:
|
19
|
+
adapter: sqlite3
|
20
|
+
database: db/production.sqlite3
|
21
|
+
pool: 5
|
22
|
+
timeout: 5000
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_view.debug_rjs = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Don't care if the mailer can't send
|
18
|
+
config.action_mailer.raise_delivery_errors = false
|
19
|
+
|
20
|
+
# Print deprecation notices to the Rails logger
|
21
|
+
config.active_support.deprecation = :log
|
22
|
+
|
23
|
+
# Only use best-standards-support built into browsers
|
24
|
+
config.action_dispatch.best_standards_support = :builtin
|
25
|
+
end
|
26
|
+
|