ish_lib_engine 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/ish_lib_engine/application.js +13 -0
- data/app/assets/javascripts/ish_lib_engine/articles.js +2 -0
- data/app/assets/stylesheets/ish_lib_engine/application.css +15 -0
- data/app/assets/stylesheets/ish_lib_engine/articles.css +4 -0
- data/app/assets/stylesheets/scaffold.css +56 -0
- data/app/controllers/ish_lib_engine/application_controller.rb +4 -0
- data/app/controllers/ish_lib_engine/articles_controller.rb +62 -0
- data/app/controllers/ish_lib_engine/manager/cities_controller.rb +95 -0
- data/app/controllers/ish_lib_engine/manager/cities_controller.rb~ +95 -0
- data/app/controllers/ish_lib_engine/manager/features_controller.rb +122 -0
- data/app/controllers/ish_lib_engine/manager/features_controller.rb~ +122 -0
- data/app/controllers/ish_lib_engine/manager/galleries_controller.rb +78 -0
- data/app/controllers/ish_lib_engine/manager/galleries_controller.rb~ +78 -0
- data/app/controllers/ish_lib_engine/manager/manager_controller.rb +31 -0
- data/app/controllers/ish_lib_engine/manager/manager_controller.rb~ +31 -0
- data/app/controllers/ish_lib_engine/manager/newsitems_controller.rb +47 -0
- data/app/controllers/ish_lib_engine/manager/newsitems_controller.rb~ +47 -0
- data/app/controllers/ish_lib_engine/manager/photos_controller.rb +20 -0
- data/app/controllers/ish_lib_engine/manager/photos_controller.rb~ +20 -0
- data/app/controllers/ish_lib_engine/manager/reports_controller.rb +62 -0
- data/app/controllers/ish_lib_engine/manager/reports_controller.rb~ +62 -0
- data/app/controllers/ish_lib_engine/manager/sites_controller.rb +72 -0
- data/app/controllers/ish_lib_engine/manager/sites_controller.rb~ +72 -0
- data/app/controllers/ish_lib_engine/manager/tags_controller.rb +54 -0
- data/app/controllers/ish_lib_engine/manager/tags_controller.rb~ +54 -0
- data/app/controllers/ish_lib_engine/manager/users_controller.rb +13 -0
- data/app/controllers/ish_lib_engine/manager/users_controller.rb~ +13 -0
- data/app/controllers/ish_lib_engine/manager/welcome_controller.rb +8 -0
- data/app/controllers/ish_lib_engine/manager/welcome_controller.rb~ +9 -0
- data/app/helpers/ish_lib_engine/application_helper.rb +4 -0
- data/app/helpers/ish_lib_engine/articles_helper.rb +4 -0
- data/app/models/ability.rb +152 -0
- data/app/models/ability.rb~ +151 -0
- data/app/models/admin_user.rb +113 -0
- data/app/models/app_model2.rb +33 -0
- data/app/models/auth_token.rb +17 -0
- data/app/models/aux_model.rb +22 -0
- data/app/models/cities_user.rb +17 -0
- data/app/models/city.rb +117 -0
- data/app/models/country.rb +13 -0
- data/app/models/day.rb +21 -0
- data/app/models/decoded_auth_token.rb +6 -0
- data/app/models/event.rb +21 -0
- data/app/models/feature.rb +38 -0
- data/app/models/gallery.rb +59 -0
- data/app/models/ish_lib_engine/article.rb +4 -0
- data/app/models/ish_lib_engine/comment.rb +4 -0
- data/app/models/manager.rb +10 -0
- data/app/models/manager_city.rb +4 -0
- data/app/models/manager_feature.rb +4 -0
- data/app/models/manager_gallery.rb +3 -0
- data/app/models/manager_newsitem.rb +5 -0
- data/app/models/manager_photo.rb +3 -0
- data/app/models/manager_report.rb +4 -0
- data/app/models/manager_site.rb +4 -0
- data/app/models/manager_tag.rb +6 -0
- data/app/models/manager_user.rb +3 -0
- data/app/models/manager_venue.rb +4 -0
- data/app/models/message.rb +14 -0
- data/app/models/newsitem.rb +50 -0
- data/app/models/nodeitem.rb +18 -0
- data/app/models/photo.rb +68 -0
- data/app/models/rate_me.rb +13 -0
- data/app/models/report.rb +144 -0
- data/app/models/review.rb +4 -0
- data/app/models/site.rb +83 -0
- data/app/models/tag.rb +78 -0
- data/app/models/user.rb +122 -0
- data/app/models/user_profile.rb +20 -0
- data/app/models/venue.rb +69 -0
- data/app/models/video.rb +48 -0
- data/app/models/welcome.rb +6 -0
- data/app/models/wikitravel_page.rb +19 -0
- data/app/views/application/_flash_messages.haml +24 -0
- data/app/views/application/_flash_messages.haml~ +24 -0
- data/app/views/ish_lib_engine/articles/_form.html.erb +25 -0
- data/app/views/ish_lib_engine/articles/edit.html.erb +6 -0
- data/app/views/ish_lib_engine/articles/index.html.erb +29 -0
- data/app/views/ish_lib_engine/articles/new.html.erb +5 -0
- data/app/views/ish_lib_engine/articles/show.html.erb +14 -0
- data/app/views/layouts/ish_lib_engine/application.html.erb +14 -0
- data/config/routes.rb +3 -0
- data/db/migrate/20160501041837_create_ish_lib_engine_articles.rb +10 -0
- data/db/migrate/20160501041940_create_ish_lib_engine_comments.rb +10 -0
- data/lib/addressbookitems_tasks.rb +33 -0
- data/lib/cities_tasks.rb +143 -0
- data/lib/core_extensions.rb +21 -0
- data/lib/features_tasks.rb +17 -0
- data/lib/float.rb +14 -0
- data/lib/galleries_tasks.rb +91 -0
- data/lib/ish_lib_engine.rb +4 -0
- data/lib/ish_lib_engine/engine.rb +5 -0
- data/lib/ish_lib_engine/version.rb +3 -0
- data/lib/reports_tasks.rb +53 -0
- data/lib/sitemaps_tasks.rb +108 -0
- data/lib/sites_tasks.rb +31 -0
- data/lib/string.rb +15 -0
- data/lib/tags_tasks.rb +104 -0
- data/lib/tasks/cities.rake +29 -0
- data/lib/tasks/galleries.rake +19 -0
- data/lib/tasks/ish_lib_engine_tasks.rake +4 -0
- data/lib/tasks/reports.rake +37 -0
- data/lib/tasks/resque.rake +8 -0
- data/lib/tasks/sitemaps.rake +12 -0
- data/lib/tasks/sites.rake +12 -0
- data/lib/tasks/tags.rake +17 -0
- data/lib/tasks/users.rake +14 -0
- data/lib/tasks/venues.rake +13 -0
- data/lib/tasks/videos.rake +18 -0
- data/lib/tasks/wikitravel_pages.rake +40 -0
- data/lib/test_extensions.rb +9 -0
- data/lib/u.rb +34 -0
- data/lib/users_tasks.rb +88 -0
- data/lib/venues_tasks.rb +15 -0
- data/lib/videos_tasks.rb +71 -0
- data/lib/wikitravel_tasks.rb +139 -0
- data/spec/factories/cities.rb +89 -0
- data/spec/factories/galleries.rb +133 -0
- data/spec/factories/photo.rb +20 -0
- data/spec/factories/reports.rb +379 -0
- data/spec/factories/site.rb +26 -0
- data/spec/factories/tag.rb +42 -0
- data/spec/factories/user.rb +87 -0
- data/spec/factories/user_profiles.rb +33 -0
- data/spec/factories/venues.rb +25 -0
- data/spec/factories/videos.rb +38 -0
- data/test/controllers/ish_lib_engine/articles_controller_test.rb +52 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +30 -0
- data/test/dummy/log/development.log +15 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/fixtures/ish_lib_engine/articles.yml +9 -0
- data/test/fixtures/ish_lib_engine/comments.yml +9 -0
- data/test/integration/navigation_test.rb +8 -0
- data/test/ish_lib_engine_test.rb +7 -0
- data/test/models/ish_lib_engine/article_test.rb +9 -0
- data/test/models/ish_lib_engine/comment_test.rb +9 -0
- data/test/test_helper.rb +21 -0
- metadata +361 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
class Manager::PhotosController < Manager::ManagerController
|
3
|
+
|
4
|
+
def without_gallery
|
5
|
+
@photos = Photo.unscoped.where( :gallery => nil, :is_trash => false )
|
6
|
+
end
|
7
|
+
|
8
|
+
def destroy
|
9
|
+
@photo = Photo.unscoped.find params[:id]
|
10
|
+
@photo.is_trash = true
|
11
|
+
@photo.save
|
12
|
+
redirect_to request.referrer
|
13
|
+
end
|
14
|
+
|
15
|
+
def show
|
16
|
+
@photo = Photo.unscoped.find params[:id]
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,62 @@
|
|
1
|
+
|
2
|
+
class IshLibEngine::Manager::ReportsController < Manager::ManagerController
|
3
|
+
|
4
|
+
before_action :authenticate_user!
|
5
|
+
before_filter :set_lists
|
6
|
+
|
7
|
+
def index
|
8
|
+
@reports = Report.unscoped.where( :is_trash => false ).page( params[:reports_page] ).per( Report::PER_PAGE )
|
9
|
+
if false === params[:site]
|
10
|
+
@reports = @reports.where( :site_id => nil )
|
11
|
+
end
|
12
|
+
if params[:site_id]
|
13
|
+
@site = Site.find params[:site_id]
|
14
|
+
@reports = @reports.where( :site_id => params[:site_id] )
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def show
|
19
|
+
@report = Report.unscoped.where({ :is_trash => false }).find params[:id]
|
20
|
+
end
|
21
|
+
|
22
|
+
def edit
|
23
|
+
@report = Report.unscoped.find params[:id]
|
24
|
+
end
|
25
|
+
|
26
|
+
def destroy
|
27
|
+
@report = Report.unscoped.find params[:id]
|
28
|
+
@report.is_trash = true
|
29
|
+
@report.save
|
30
|
+
redirect_to request.referrer
|
31
|
+
end
|
32
|
+
|
33
|
+
def update
|
34
|
+
@report = Report.unscoped.find params[:id]
|
35
|
+
authorize! :update, @report
|
36
|
+
|
37
|
+
# photo
|
38
|
+
photo = Photo.new
|
39
|
+
photo.photo = params[:report][:photo]
|
40
|
+
photo.report_id = @report.id
|
41
|
+
photo.user = @report.user
|
42
|
+
photo.is_public = @report.is_public
|
43
|
+
photo.is_trash = false
|
44
|
+
photo.save
|
45
|
+
@report.photo = photo
|
46
|
+
params[:report][:photo] = nil
|
47
|
+
|
48
|
+
respond_to do |format|
|
49
|
+
if @report.update_attributes(params[:report].permit( :name, :subhead, :descr, :venue, :city, :x, :y, :tag, :is_public, :photo, :site, :site_id ))
|
50
|
+
format.html do
|
51
|
+
redirect_to manager_report_path(@report), :notice => 'Report was successfully updated.'
|
52
|
+
end
|
53
|
+
format.json { head :ok }
|
54
|
+
else
|
55
|
+
format.html { render :action => "edit" }
|
56
|
+
format.json { render :json => @report.errors, :status => :unprocessable_entity }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
@@ -0,0 +1,62 @@
|
|
1
|
+
|
2
|
+
class Manager::ReportsController < Manager::ManagerController
|
3
|
+
|
4
|
+
before_action :authenticate_user!
|
5
|
+
before_filter :set_lists
|
6
|
+
|
7
|
+
def index
|
8
|
+
@reports = Report.unscoped.where( :is_trash => false ).page( params[:reports_page] ).per( Report::PER_PAGE )
|
9
|
+
if false === params[:site]
|
10
|
+
@reports = @reports.where( :site_id => nil )
|
11
|
+
end
|
12
|
+
if params[:site_id]
|
13
|
+
@site = Site.find params[:site_id]
|
14
|
+
@reports = @reports.where( :site_id => params[:site_id] )
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def show
|
19
|
+
@report = Report.unscoped.where({ :is_trash => false }).find params[:id]
|
20
|
+
end
|
21
|
+
|
22
|
+
def edit
|
23
|
+
@report = Report.unscoped.find params[:id]
|
24
|
+
end
|
25
|
+
|
26
|
+
def destroy
|
27
|
+
@report = Report.unscoped.find params[:id]
|
28
|
+
@report.is_trash = true
|
29
|
+
@report.save
|
30
|
+
redirect_to request.referrer
|
31
|
+
end
|
32
|
+
|
33
|
+
def update
|
34
|
+
@report = Report.unscoped.find params[:id]
|
35
|
+
authorize! :update, @report
|
36
|
+
|
37
|
+
# photo
|
38
|
+
photo = Photo.new
|
39
|
+
photo.photo = params[:report][:photo]
|
40
|
+
photo.report_id = @report.id
|
41
|
+
photo.user = @report.user
|
42
|
+
photo.is_public = @report.is_public
|
43
|
+
photo.is_trash = false
|
44
|
+
photo.save
|
45
|
+
@report.photo = photo
|
46
|
+
params[:report][:photo] = nil
|
47
|
+
|
48
|
+
respond_to do |format|
|
49
|
+
if @report.update_attributes(params[:report].permit( :name, :subhead, :descr, :venue, :city, :x, :y, :tag, :is_public, :photo, :site, :site_id ))
|
50
|
+
format.html do
|
51
|
+
redirect_to manager_report_path(@report), :notice => 'Report was successfully updated.'
|
52
|
+
end
|
53
|
+
format.json { head :ok }
|
54
|
+
else
|
55
|
+
format.html { render :action => "edit" }
|
56
|
+
format.json { render :json => @report.errors, :status => :unprocessable_entity }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
@@ -0,0 +1,72 @@
|
|
1
|
+
|
2
|
+
class IshLibEngine::Manager::SitesController < Manager::ManagerController
|
3
|
+
|
4
|
+
PERMITTED_ATTRIBUTES = [ :domain, :lang, :title, :subhead, :homepage_layout, :layout,
|
5
|
+
:n_features, :n_newsitems, :is_trash, :is_ads_enabled, :is_private,
|
6
|
+
:home_redirect_path, :is_video_enabled, :is_resume_enabled, :is_primary
|
7
|
+
]
|
8
|
+
|
9
|
+
|
10
|
+
def index
|
11
|
+
@sites = Site.all.order_by( :domainname => :desc, :lang => :desc )
|
12
|
+
end
|
13
|
+
|
14
|
+
def trash
|
15
|
+
@sites = Site.unscoped.where( :is_trash => true ).order_by( :domainname => :desc, :lang => :desc )
|
16
|
+
render :action => :index
|
17
|
+
end
|
18
|
+
|
19
|
+
def show
|
20
|
+
@site = Site.find params[:id]
|
21
|
+
@galleries = @site.galleries.unscoped.where({ :is_trash => false }).page( params[:galleries_page] ).per( 10 )
|
22
|
+
@reports = @site.reports.unscoped.where({ :is_trash => false }).page( params[:reports_page] ).per( 10 )
|
23
|
+
@videos = @site.videos.page( params[:videos_page] ).per( 5 )
|
24
|
+
@tags = @site.tags.page( params[:tags_page] ).per( 100 )
|
25
|
+
@features = @site.features.page( params[:features_page] ).per( 9 )
|
26
|
+
@newsitems = @site.newsitems.page( params[:newsitems_page] ).per( 10 )
|
27
|
+
end
|
28
|
+
|
29
|
+
def edit
|
30
|
+
@site = Site.find params[:id]
|
31
|
+
authorize! :update, @site
|
32
|
+
end
|
33
|
+
|
34
|
+
def new
|
35
|
+
authorize! :new, Site.new
|
36
|
+
@site = Site.new
|
37
|
+
end
|
38
|
+
|
39
|
+
def create
|
40
|
+
authorize! :create, Site.new
|
41
|
+
@site = Site.new params[:site].permit( PERMITTED_ATTRIBUTES )
|
42
|
+
if @site.save
|
43
|
+
flash[:notice] = 'Success'
|
44
|
+
else
|
45
|
+
flash[:error] = 'No Luck. ' + @site.errors.inspect
|
46
|
+
end
|
47
|
+
redirect_to manager_sites_path
|
48
|
+
end
|
49
|
+
|
50
|
+
def update
|
51
|
+
@site = Site.find params[:id]
|
52
|
+
authorize! :update, @site
|
53
|
+
|
54
|
+
if @site.update_attributes params[:site].permit( PERMITTED_ATTRIBUTES )
|
55
|
+
flash[:notice] = 'Success'
|
56
|
+
else
|
57
|
+
flash[:error] = 'No Luck'
|
58
|
+
end
|
59
|
+
redirect_to manager_sites_path
|
60
|
+
end
|
61
|
+
|
62
|
+
def newsitem_delete
|
63
|
+
@site = Site.find params[:site_id]
|
64
|
+
authorize! :update, @site
|
65
|
+
n = @site.newsitems.find( params[:newsitem_id] )
|
66
|
+
n.delete
|
67
|
+
@site.save
|
68
|
+
flash[:notice] = 'Probably successfully deleted a newsitem.'
|
69
|
+
redirect_to manager_site_path( @site.id )
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
|
2
|
+
class Manager::SitesController < Manager::ManagerController
|
3
|
+
|
4
|
+
PERMITTED_ATTRIBUTES = [ :domain, :lang, :title, :subhead, :homepage_layout, :layout,
|
5
|
+
:n_features, :n_newsitems, :is_trash, :is_ads_enabled, :is_private,
|
6
|
+
:home_redirect_path, :is_video_enabled, :is_resume_enabled, :is_primary
|
7
|
+
]
|
8
|
+
|
9
|
+
|
10
|
+
def index
|
11
|
+
@sites = Site.all.order_by( :domainname => :desc, :lang => :desc )
|
12
|
+
end
|
13
|
+
|
14
|
+
def trash
|
15
|
+
@sites = Site.unscoped.where( :is_trash => true ).order_by( :domainname => :desc, :lang => :desc )
|
16
|
+
render :action => :index
|
17
|
+
end
|
18
|
+
|
19
|
+
def show
|
20
|
+
@site = Site.find params[:id]
|
21
|
+
@galleries = @site.galleries.unscoped.where({ :is_trash => false }).page( params[:galleries_page] ).per( 10 )
|
22
|
+
@reports = @site.reports.unscoped.where({ :is_trash => false }).page( params[:reports_page] ).per( 10 )
|
23
|
+
@videos = @site.videos.page( params[:videos_page] ).per( 5 )
|
24
|
+
@tags = @site.tags.page( params[:tags_page] ).per( 100 )
|
25
|
+
@features = @site.features.page( params[:features_page] ).per( 9 )
|
26
|
+
@newsitems = @site.newsitems.page( params[:newsitems_page] ).per( 10 )
|
27
|
+
end
|
28
|
+
|
29
|
+
def edit
|
30
|
+
@site = Site.find params[:id]
|
31
|
+
authorize! :update, @site
|
32
|
+
end
|
33
|
+
|
34
|
+
def new
|
35
|
+
authorize! :new, Site.new
|
36
|
+
@site = Site.new
|
37
|
+
end
|
38
|
+
|
39
|
+
def create
|
40
|
+
authorize! :create, Site.new
|
41
|
+
@site = Site.new params[:site].permit( PERMITTED_ATTRIBUTES )
|
42
|
+
if @site.save
|
43
|
+
flash[:notice] = 'Success'
|
44
|
+
else
|
45
|
+
flash[:error] = 'No Luck. ' + @site.errors.inspect
|
46
|
+
end
|
47
|
+
redirect_to manager_sites_path
|
48
|
+
end
|
49
|
+
|
50
|
+
def update
|
51
|
+
@site = Site.find params[:id]
|
52
|
+
authorize! :update, @site
|
53
|
+
|
54
|
+
if @site.update_attributes params[:site].permit( PERMITTED_ATTRIBUTES )
|
55
|
+
flash[:notice] = 'Success'
|
56
|
+
else
|
57
|
+
flash[:error] = 'No Luck'
|
58
|
+
end
|
59
|
+
redirect_to manager_sites_path
|
60
|
+
end
|
61
|
+
|
62
|
+
def newsitem_delete
|
63
|
+
@site = Site.find params[:site_id]
|
64
|
+
authorize! :update, @site
|
65
|
+
n = @site.newsitems.find( params[:newsitem_id] )
|
66
|
+
n.delete
|
67
|
+
@site.save
|
68
|
+
flash[:notice] = 'Probably successfully deleted a newsitem.'
|
69
|
+
redirect_to manager_site_path( @site.id )
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
|
2
|
+
class IshLibEngine::Manager::TagsController < Manager::ManagerController
|
3
|
+
|
4
|
+
before_filter :set_lists
|
5
|
+
|
6
|
+
def index
|
7
|
+
@tags = Tag.unscoped
|
8
|
+
authorize! :index, Tag.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def show
|
12
|
+
@tag = Tag.unscoped.find params[:id]
|
13
|
+
authorize! :show, @tag
|
14
|
+
end
|
15
|
+
|
16
|
+
def new
|
17
|
+
@tag = Tag.new
|
18
|
+
authorize! :new, @tag
|
19
|
+
end
|
20
|
+
|
21
|
+
def create
|
22
|
+
@tag = Tag.create params[:tag].permit( :name, :name_seo, :descr, :is_public, :is_feature, :is_trash,
|
23
|
+
:weight, :parent_tag_id, :site_id )
|
24
|
+
authorize! :create, @tag
|
25
|
+
if @tag.save
|
26
|
+
flash[:notice] = 'Success.'
|
27
|
+
redirect_to manager_tags_path
|
28
|
+
else
|
29
|
+
puts! @tag.errors, "error creating tag."
|
30
|
+
flash[:error] = "No luck. #{@tag.errors.messages}"
|
31
|
+
render :action => :new
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def edit
|
36
|
+
@tag = Tag.unscoped.find params[:id]
|
37
|
+
authorize! :edit, @tag
|
38
|
+
end
|
39
|
+
|
40
|
+
def update
|
41
|
+
@tag = Tag.unscoped.find params[:id]
|
42
|
+
authorize! :update, @tag
|
43
|
+
if @tag.update_attributes params[:tag].permit( :name, :name_seo, :descr,
|
44
|
+
:is_public, :is_trash, :is_feature, :weight,
|
45
|
+
:site_id, :parent_tag_id )
|
46
|
+
flash[:notice] = 'Success.'
|
47
|
+
redirect_to manager_tags_path
|
48
|
+
else
|
49
|
+
flash[:error] = 'No luck.'
|
50
|
+
render :action => :new
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
|
2
|
+
class Manager::TagsController < Manager::ManagerController
|
3
|
+
|
4
|
+
before_filter :set_lists
|
5
|
+
|
6
|
+
def index
|
7
|
+
@tags = Tag.unscoped
|
8
|
+
authorize! :index, Tag.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def show
|
12
|
+
@tag = Tag.unscoped.find params[:id]
|
13
|
+
authorize! :show, @tag
|
14
|
+
end
|
15
|
+
|
16
|
+
def new
|
17
|
+
@tag = Tag.new
|
18
|
+
authorize! :new, @tag
|
19
|
+
end
|
20
|
+
|
21
|
+
def create
|
22
|
+
@tag = Tag.create params[:tag].permit( :name, :name_seo, :descr, :is_public, :is_feature, :is_trash,
|
23
|
+
:weight, :parent_tag_id, :site_id )
|
24
|
+
authorize! :create, @tag
|
25
|
+
if @tag.save
|
26
|
+
flash[:notice] = 'Success.'
|
27
|
+
redirect_to manager_tags_path
|
28
|
+
else
|
29
|
+
puts! @tag.errors, "error creating tag."
|
30
|
+
flash[:error] = "No luck. #{@tag.errors.messages}"
|
31
|
+
render :action => :new
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def edit
|
36
|
+
@tag = Tag.unscoped.find params[:id]
|
37
|
+
authorize! :edit, @tag
|
38
|
+
end
|
39
|
+
|
40
|
+
def update
|
41
|
+
@tag = Tag.unscoped.find params[:id]
|
42
|
+
authorize! :update, @tag
|
43
|
+
if @tag.update_attributes params[:tag].permit( :name, :name_seo, :descr,
|
44
|
+
:is_public, :is_trash, :is_feature, :weight,
|
45
|
+
:site_id, :parent_tag_id )
|
46
|
+
flash[:notice] = 'Success.'
|
47
|
+
redirect_to manager_tags_path
|
48
|
+
else
|
49
|
+
flash[:error] = 'No luck.'
|
50
|
+
render :action => :new
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|