ish_manager 0.1.1 → 0.1.2

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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/ish_manager/application.js +0 -1
  3. data/app/assets/stylesheets/ish_manager/application.css +4 -0
  4. data/app/controllers/ish_manager/application_controller.rb +1 -1
  5. data/app/controllers/ish_manager/features_controller.rb +125 -0
  6. data/app/controllers/ish_manager/galleries_controller.rb +86 -0
  7. data/app/controllers/ish_manager/newsitems_controller.rb +113 -0
  8. data/app/controllers/ish_manager/photos_controller.rb +55 -0
  9. data/app/controllers/ish_manager/reports_controller.rb +64 -0
  10. data/app/controllers/ish_manager/sites_controller.rb +2 -0
  11. data/app/controllers/ish_manager/tags_controller.rb +54 -0
  12. data/app/controllers/ish_manager/users_controller.rb +13 -0
  13. data/app/helpers/ish_manager/images_helper.rb +2 -1
  14. data/app/views/ish_manager/application/_main_footer.haml +6 -2
  15. data/app/views/ish_manager/cities/edit.haml +3 -3
  16. data/app/views/ish_manager/features/_form.haml +61 -0
  17. data/app/views/ish_manager/features/_index.haml +23 -0
  18. data/app/views/ish_manager/features/_item.haml +14 -0
  19. data/app/views/ish_manager/features/edit.haml +16 -0
  20. data/app/views/ish_manager/features/index.haml +25 -0
  21. data/app/views/ish_manager/features/new.haml +11 -0
  22. data/app/views/ish_manager/features/show.haml +0 -0
  23. data/app/views/ish_manager/galleries/#_thumbs.haml# +5 -0
  24. data/app/views/ish_manager/galleries/_form.haml +46 -0
  25. data/app/views/ish_manager/galleries/_index.haml +14 -0
  26. data/app/views/ish_manager/galleries/_list.haml +23 -0
  27. data/app/views/ish_manager/galleries/_list_short.haml +9 -0
  28. data/app/views/ish_manager/galleries/_menu_secondary.haml +13 -0
  29. data/app/views/ish_manager/galleries/_meta.haml +16 -0
  30. data/app/views/ish_manager/galleries/_search.haml +7 -0
  31. data/app/views/ish_manager/galleries/_thumbs.haml +12 -0
  32. data/app/views/ish_manager/galleries/_title.haml +17 -0
  33. data/app/views/ish_manager/galleries/all_photos.haml +4 -0
  34. data/app/views/ish_manager/galleries/edit.haml +11 -0
  35. data/app/views/ish_manager/galleries/index.haml +18 -0
  36. data/app/views/ish_manager/galleries/index_ajax.haml +9 -0
  37. data/app/views/ish_manager/galleries/index_mini.haml +0 -0
  38. data/app/views/ish_manager/galleries/index_short.haml +19 -0
  39. data/app/views/ish_manager/galleries/index_thumb.haml +16 -0
  40. data/app/views/ish_manager/galleries/index_title.haml +15 -0
  41. data/app/views/ish_manager/galleries/index_trash.haml +20 -0
  42. data/app/views/ish_manager/galleries/new.haml +7 -0
  43. data/app/views/ish_manager/galleries/show.haml +34 -0
  44. data/app/views/ish_manager/newsitems/_form.haml +10 -0
  45. data/app/views/ish_manager/newsitems/_index.haml +17 -0
  46. data/app/views/ish_manager/newsitems/_item.haml +53 -0
  47. data/app/views/ish_manager/newsitems/edit.haml +14 -0
  48. data/app/views/ish_manager/newsitems/new.haml +16 -0
  49. data/app/views/ish_manager/photos/_meta.haml +9 -0
  50. data/app/views/ish_manager/photos/_multinew.haml +23 -0
  51. data/app/views/ish_manager/photos/show.haml +2 -0
  52. data/app/views/ish_manager/photos/without_gallery.haml +11 -0
  53. data/app/views/ish_manager/reports/_form.haml +42 -0
  54. data/app/views/ish_manager/reports/_index.haml +16 -0
  55. data/app/views/ish_manager/reports/edit.haml +6 -0
  56. data/app/views/ish_manager/reports/index.haml +26 -0
  57. data/app/views/ish_manager/reports/new.haml +5 -0
  58. data/app/views/ish_manager/reports/show.haml +18 -0
  59. data/app/views/ish_manager/sites/_form.haml +1 -1
  60. data/app/views/ish_manager/sites/edit.haml +2 -2
  61. data/app/views/ish_manager/sites/index.haml +7 -7
  62. data/app/views/ish_manager/videos/_index.haml +12 -0
  63. data/app/views/layouts/ish_manager/application.haml +2 -1
  64. data/config/routes.rb +4 -1
  65. data/lib/ish_manager.rb +2 -0
  66. data/lib/ish_manager/version.rb +1 -1
  67. metadata +80 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0cfa88bf3f34c888931d6c74c7947a808bfba2e3
4
- data.tar.gz: d2accbb15d1c9ddff1752369420a11e2e1def753
3
+ metadata.gz: 386df990fd25601d248cc6d61d7f99582e6424c9
4
+ data.tar.gz: ad0a09b3cf2ae85f4f2a2b3e63f2a79dcca9cd0f
5
5
  SHA512:
6
- metadata.gz: edad58e14796b84da5ea868aac3cafb6779daa0f2f73516f2ceef82a1609ec0bd79c8e2d57bc7d8bf57ca24c6a839034d13e0d48e0d2fa1986a0c48847b0336a
7
- data.tar.gz: e5ee903cd3e72877bb8b733c90da50b0e75a9037b872340c648cc815cc0a7681bfeafbb7e313c0d2480c508b13ce6e9477f6736cb5ce9fe003db6996ec9c7b2a
6
+ metadata.gz: c33d311e19b0588aab164195675c353fde025205737b36cc790cd6b51035a2128f36dddc11e81a9decb68ccb2f658c9325133426dfe4aad615a13a5b33be8a87
7
+ data.tar.gz: c0b59333ac7b84a7ccf7c6464da49cedb1d943962895254cece215b28a824b47ad48b6144c4c9441fd04e6c44d9841998fd6b406002f41661e9373a34193d24d
@@ -12,4 +12,3 @@
12
12
  //
13
13
  //= require_tree .
14
14
  //
15
-
@@ -13,3 +13,7 @@
13
13
  *= require_tree .
14
14
  *= require_self
15
15
  */
16
+
17
+ .center {
18
+ text-align: center;
19
+ }
@@ -1,8 +1,8 @@
1
1
  module IshManager
2
2
  class ApplicationController < ActionController::Base
3
3
  protect_from_forgery :with => :exception
4
-
5
4
  before_action :set_current_ability
5
+ check_authorization
6
6
 
7
7
  def home
8
8
  authorize! :home, Manager
@@ -0,0 +1,125 @@
1
+
2
+ class IshManager::FeaturesController < IshManager::ApplicationController
3
+
4
+ before_action :set_lists
5
+
6
+ def new
7
+ authorize! :new, ManagerFeature.new
8
+ @city = City.find params[:city_id] unless params[:city_id].blank?
9
+ @site = Site.find params[:site_id] unless params[:site_id].blank?
10
+ @tag = Tag.find params[:tag_id] unless params[:tag_id].blank?
11
+ @feature = Feature.new
12
+ end
13
+
14
+ def create
15
+ authorize! :create, ManagerFeature.new
16
+
17
+ @feature = Feature.new params[:feature].permit( :name, :subhead, :image_path, :link_path, :partial_name, :photo, :weight,
18
+ :report, :report_id, :gallery, :gallery_id, :video, :video_id
19
+ )
20
+ if params[:city_id]
21
+ @city = City.find params[:city_id]
22
+ @city.features << @feature
23
+ redirect_path = manager_cities_path
24
+ end
25
+ if params[:site_id]
26
+ @site = Site.find params[:site_id]
27
+ @site.features << @feature
28
+ redirect_path = manager_sites_path
29
+ end
30
+ if params[:tag_id]
31
+ @tag = Tag.find params[:tag_id]
32
+ @tag.features << @feature
33
+ redirect_path = manager_tags_path
34
+ end
35
+
36
+ if (@city && @city.save) || (@site && @site.save) || (@tag && @tag.save)
37
+ flash[:notice] = 'Success.'
38
+ redirect_to redirect_path
39
+ else
40
+ flash[:error] = 'No Luck. ' + ( @city || @site || @tag ).errors.inspect
41
+ render :action => :new
42
+ end
43
+ end
44
+
45
+ def edit
46
+ authorize! :edit, ManagerCity.new
47
+
48
+ if params[:city_id]
49
+ @city = City.find params[:city_id]
50
+ @feature = @city.features.find params[:id]
51
+ end
52
+
53
+ if params[:site_id]
54
+ @site = Site.find params[:site_id]
55
+ @feature = @site.features.find params[:id]
56
+ end
57
+
58
+ if params[:tag_id]
59
+ @tag = Tag.find params[:tag_id]
60
+ @feature = @tag.features.find params[:id]
61
+ end
62
+
63
+ if params[:venue_id]
64
+ @venue = Tag.find params[:venue_id]
65
+ @feature = @venue.features.find params[:id]
66
+ end
67
+
68
+ end
69
+
70
+ def update
71
+ unless params[:city_id].blank?
72
+ @city = City.find params[:city_id]
73
+ authorize! :update, ManagerCity.new
74
+ @feature = @city.features.find params[:id]
75
+ redirect_path = manager_city_path( @city )
76
+ end
77
+ unless params[:site_id].blank?
78
+ @site = Site.find params[:site_id]
79
+ authorize! :update, ManagerSite.new
80
+ @feature = @site.features.find params[:id]
81
+ redirect_path = manager_site_path( @site )
82
+ end
83
+ unless params[:tag_id].blank?
84
+ @tag = Tag.find params[:tag_id]
85
+ authorize! :update, ManagerTag.new
86
+ @feature = @tag.features.find params[:id]
87
+ redirect_path = manager_tag_path( @tag )
88
+ end
89
+
90
+ if @feature.update_attributes params[:feature].permit!
91
+ flash[:notice] = 'Success'
92
+ redirect_to redirect_path
93
+ else
94
+ flash[:error] = 'No Luck. ' + @feature.errors.inspect
95
+ puts! @feature.errors, 'Errors updating feature'
96
+ render :action => :edit_feature
97
+ end
98
+ end
99
+
100
+ def index
101
+ if params[:tag_id]
102
+ @resource = Tag.find params[:tag_id]
103
+ end
104
+
105
+ end
106
+
107
+ def destroy
108
+ if params[:tag_id]
109
+ @resource = Tag.find params[:tag_id]
110
+ elsif params[:city_id]
111
+ @resource = City.find params[:city_id]
112
+ elsif params[:site_id]
113
+ @resource = Site.find params[:site_id]
114
+ end
115
+ @feature = @resource.features.find params[:id]
116
+ if @feature.destroy
117
+ flash[:notice] = :'Success.'
118
+ else
119
+ flash[:error] = :'No luck.'
120
+ end
121
+ redirect_to request.referrer
122
+ end
123
+
124
+ end
125
+
@@ -0,0 +1,86 @@
1
+ class IshManager::GalleriesController < IshManager::ApplicationController
2
+
3
+ # before_action :set_lists
4
+
5
+ def index
6
+ authorize! :index, Gallery
7
+ @galleries = Gallery.unscoped.where( :is_trash => false ).order_by( :created_at => :desc ).page( params[:galleries_page] ).per( 10 )
8
+ end
9
+
10
+ def index_thumb
11
+ @galleries = Gallery.unscoped.where( :is_trash => false ).order_by( :created_at => :desc ).page( params[:galleries_page] ).per( 10 )
12
+ end
13
+
14
+ def index_mini
15
+ @galleries = Gallery.all
16
+ end
17
+
18
+ def new
19
+ @gallery = Gallery.new
20
+ @cities_list = City.list
21
+ @tags_list = Tag.list
22
+ end
23
+
24
+ def create
25
+ @gallery = Gallery.new params[:gallery].permit!
26
+ @gallery.user = current_user
27
+ authorize! :create, @gallery
28
+
29
+ if @gallery.save
30
+ flash[:notice] = 'Success'
31
+ redirect_to manager_galleries_path
32
+ else
33
+ flash[:error] = 'No Luck. ' + @gallery.errors.inspect
34
+ @cities_list = City.list
35
+ @tags_list = Tag.list
36
+ render :action => 'new'
37
+ end
38
+ end
39
+
40
+ def edit
41
+ @gallery = Gallery.unscoped.find params[:id]
42
+ end
43
+
44
+ def update
45
+ @gallery = Gallery.unscoped.find params[:id]
46
+ if @gallery.update_attributes( params[:gallery].permit! )
47
+ flash[:notice] = 'Success.'
48
+ redirect_to manager_galleries_path
49
+ else
50
+ flash[:error] = 'No Luck. ' + @gallery.errors
51
+ render :action => :edit
52
+ end
53
+ end
54
+
55
+ def show
56
+ @gallery = Gallery.unscoped.find_by :galleryname => params[:id]
57
+ authorize! :show, @gallery
58
+ @photos = @gallery.photos.unscoped.where({ :is_trash => false })
59
+ end
60
+
61
+ def destroy
62
+ @gallery = Gallery.unscoped.find params[:id]
63
+ @gallery.is_trash = true
64
+ @gallery.save
65
+ flash[:notice] = 'Logically deleted gallery.'
66
+ redirect_to manager_galleries_title_path
67
+ end
68
+
69
+ def j_show
70
+ @gallery = Gallery.unscoped.find( params[:id] )
71
+ authorize! :show, @gallery
72
+ respond_to do |format|
73
+ format.json do
74
+ jjj = {}
75
+ jjj[:photos] = @gallery.photos.map do |ph|
76
+ { :thumbnail_url => ph.photo.url( :thumb ),
77
+ :delete_type => 'DELETE',
78
+ :delete_url => photo_path(ph) }
79
+ end
80
+ render :json => jjj
81
+ end
82
+ end
83
+ end
84
+
85
+ end
86
+
@@ -0,0 +1,113 @@
1
+
2
+ class Manager::NewsitemsController < Manager::ManagerController
3
+
4
+ def new
5
+ authorize! :new, ManagerNewsitem.new
6
+ @newsitem = Newsitem.new
7
+ if params[:city_id]
8
+ @city = City.find params[:city_id]
9
+ @newsitem.city = @city
10
+ end
11
+ if params[:site_id]
12
+ @site = Site.find params[:site_id]
13
+ @newsitem.site = @site
14
+ end
15
+ end
16
+
17
+ def create
18
+ authorize! :create, ManagerNewsitem.new
19
+
20
+ n = Newsitem.new params[:newsitem].permit!
21
+ n.report = Report.find params[:newsitem][:report_id] unless params[:newsitem][:report_id].blank?
22
+ n.gallery = Gallery.find params[:newsitem][:gallery_id] unless params[:newsitem][:gallery_id].blank?
23
+ n.photo = Photo.find params[:newsitem][:photo_id] unless params[:newsitem][:photo_id].blank?
24
+ n.descr = params[:newsitem][:descr]
25
+
26
+ if params[:city_id]
27
+ @city = City.find params[:city_id]
28
+ @city.newsitems << n
29
+ flag = @city.save
30
+ if flag
31
+ url = edit_manager_city_path( @city.id )
32
+ else
33
+ error = 'No Luck. ' + @city.errors.inspect
34
+ end
35
+ end
36
+
37
+ if params[:site_id]
38
+ @site = Site.find params[:site_id]
39
+ @site.newsitems << n
40
+ flag = @site.save
41
+ if flag
42
+ url = edit_manager_site_path( @site.id )
43
+ else
44
+ error = 'No Luck. ' + @site.errors.inspect
45
+ end
46
+ end
47
+
48
+ if flag
49
+ flash[:notice] = 'Success'
50
+ redirect_to url
51
+ else
52
+ flash[:error] = error
53
+ render :action => :new
54
+ end
55
+ end
56
+
57
+ def show
58
+ end
59
+
60
+ def index
61
+ end
62
+
63
+ def destroy
64
+ if params[:city_id]
65
+ flag = City.find( params[:city_id] ).newsitems.find( params[:id] ).destroy
66
+ url = edit_manager_city_path( params[:city_id] )
67
+ end
68
+ if params[:site_id]
69
+ site = Site.find( params[:site_id] )
70
+ flag = site.newsitems.find( params[:id] ).destroy
71
+ url = edit_manager_site_path( params[:site_id] )
72
+ end
73
+
74
+ flash[:notice] = "Success? #{flag}"
75
+ redirect_to url
76
+ end
77
+
78
+ def update
79
+ if params[:site_id]
80
+ @site = Site.find params[:site_id]
81
+ @site.touch
82
+ @newsitem = @site.newsitems.find params[:id]
83
+ url = edit_manager_site_path( @site )
84
+ end
85
+ if params[:city_id]
86
+ @city = City.find params[:city_id]
87
+ @newsitem = @city.newsitems.find params[:id]
88
+ url = edit_manager_city_path( @city )
89
+ end
90
+ flag = @newsitem.update_attributes params[:newsitem].permit!
91
+
92
+ if flag
93
+ flash[:notice] = 'Success'
94
+ else
95
+ flash[:error] = "No Luck: #{@newsitem.errors.messages}"
96
+ end
97
+
98
+ redirect_to url
99
+ end
100
+
101
+ def edit
102
+ if params[:site_id]
103
+ @site = Site.find params[:site_id]
104
+ @newsitem = @site.newsitems.find( params[:id] )
105
+ end
106
+ if params[:city_id]
107
+ @city = City.find params[:city_id]
108
+ @newsitem = @city.newsitems.find( params[:id] )
109
+ end
110
+ end
111
+
112
+ end
113
+
@@ -0,0 +1,55 @@
1
+
2
+ class Manager::PhotosController < Manager::ManagerController
3
+
4
+ # @TODO: this is bad? _vp_ 20170513
5
+ skip_authorization_check :only => [ :j_create ]
6
+ protect_from_forgery :except => [ :j_create]
7
+
8
+ def without_gallery
9
+ @photos = Photo.unscoped.where( :gallery => nil, :is_trash => false )
10
+ end
11
+
12
+ def destroy
13
+ @photo = Photo.unscoped.find params[:id]
14
+ @photo.is_trash = true
15
+ @photo.save
16
+ redirect_to request.referrer
17
+ end
18
+
19
+ def show
20
+ @photo = Photo.unscoped.find params[:id]
21
+ end
22
+
23
+ def j_create
24
+ @photo = Photo.new params[:photo].permit!
25
+ authorize! :create, @photo
26
+ @photo.is_public = true
27
+
28
+ if params[:galleryname]
29
+ gallery = Gallery.unscoped.where( :galleryname => params[:galleryname] ).first
30
+ @photo.gallery_id = gallery.id
31
+ elsif params[:gallery_id]
32
+ gallery = Gallery.find( params[:gallery_id] )
33
+ @photo.gallery_id = gallery.id
34
+ end
35
+
36
+ # @TODO this is badd
37
+ @photo.user = User.where( :username => 'piousbox' ).first
38
+
39
+ if @photo.save
40
+ j = { :name => @photo.photo.original_filename,
41
+ :size => @photo.photo.size,
42
+ :url => @photo.photo.url( :large ),
43
+ :thumbnail_url => @photo.photo.url( :thumb ),
44
+ :delete_url => photo_path(@photo),
45
+ :delete_type => 'DELETE',
46
+ :name => @photo.name
47
+ }
48
+ render :json => [ j ]
49
+ else
50
+ render :json => { "errors" => @photo.errors }
51
+ end
52
+ end
53
+
54
+ end
55
+
@@ -0,0 +1,64 @@
1
+
2
+ class IshManager::ReportsController < IshManager::ApplicationController
3
+
4
+ # before_filter :authenticate_user!
5
+ # before_filter :set_lists
6
+
7
+ def index
8
+ authorize! :index, Report
9
+ @reports = Report.unscoped.where( :is_trash => false ).page( params[:reports_page] ).per( Report::PER_PAGE )
10
+ if false === params[:site]
11
+ @reports = @reports.where( :site_id => nil )
12
+ end
13
+ if params[:site_id]
14
+ @site = Site.find params[:site_id]
15
+ @reports = @reports.where( :site_id => params[:site_id] )
16
+ end
17
+ end
18
+
19
+ def show
20
+ @report = Report.unscoped.where({ :is_trash => false }).find params[:id]
21
+ authorize! :show, @report
22
+ end
23
+
24
+ def edit
25
+ @report = Report.unscoped.find params[:id]
26
+ end
27
+
28
+ def destroy
29
+ @report = Report.unscoped.find params[:id]
30
+ @report.is_trash = true
31
+ @report.save
32
+ redirect_to request.referrer
33
+ end
34
+
35
+ def update
36
+ @report = Report.unscoped.find params[:id]
37
+ authorize! :update, @report
38
+
39
+ # photo
40
+ photo = Photo.new
41
+ photo.photo = params[:report][:photo]
42
+ photo.report_id = @report.id
43
+ photo.user = @report.user
44
+ photo.is_public = @report.is_public
45
+ photo.is_trash = false
46
+ photo.save
47
+ @report.photo = photo
48
+ params[:report][:photo] = nil
49
+
50
+ respond_to do |format|
51
+ if @report.update_attributes(params[:report].permit( :name, :subhead, :descr, :venue, :city, :x, :y, :tag, :is_public, :photo, :site, :site_id ))
52
+ format.html do
53
+ redirect_to manager_report_path(@report), :notice => 'Report was successfully updated.'
54
+ end
55
+ format.json { head :ok }
56
+ else
57
+ format.html { render :action => "edit" }
58
+ format.json { render :json => @report.errors, :status => :unprocessable_entity }
59
+ end
60
+ end
61
+ end
62
+
63
+ end
64
+