ish_manager 0.1.8.251 → 0.1.8.255

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/bg/confectionary.png +0 -0
  3. data/app/assets/images/bg/gplaypattern.png +0 -0
  4. data/app/assets/images/bg/triangular.png +0 -0
  5. data/app/assets/images/bg/weather.png +0 -0
  6. data/app/assets/images/favicon.gif +0 -0
  7. data/app/assets/images/icons/10x10_red-cross.png +0 -0
  8. data/app/assets/images/icons/20x20/private.png +0 -0
  9. data/app/assets/images/icons/20x20/public2.png +0 -0
  10. data/app/assets/images/missing.png +0 -0
  11. data/app/assets/images/ui-icons_444444_256x240.png +0 -0
  12. data/app/assets/images/ui-icons_555555_256x240.png +0 -0
  13. data/app/assets/images/ui-icons_777620_256x240.png +0 -0
  14. data/app/assets/images/ui-icons_777777_256x240.png +0 -0
  15. data/app/assets/images/ui-icons_cc0000_256x240.png +0 -0
  16. data/app/assets/images/ui-icons_ffffff_256x240.png +0 -0
  17. data/app/assets/images/wait.gif +0 -0
  18. data/app/assets/javascripts/ish_manager/bootstrap.min.js +1 -1
  19. data/app/assets/javascripts/ish_manager/jquery-ui-1.12.1/images/ui-icons_444444_256x240.png +0 -0
  20. data/app/assets/javascripts/ish_manager/jquery-ui-1.12.1/images/ui-icons_555555_256x240.png +0 -0
  21. data/app/assets/javascripts/ish_manager/jquery-ui-1.12.1/images/ui-icons_777620_256x240.png +0 -0
  22. data/app/assets/javascripts/ish_manager/jquery-ui-1.12.1/images/ui-icons_777777_256x240.png +0 -0
  23. data/app/assets/javascripts/ish_manager/jquery-ui-1.12.1/images/ui-icons_cc0000_256x240.png +0 -0
  24. data/app/assets/javascripts/ish_manager/jquery-ui-1.12.1/images/ui-icons_ffffff_256x240.png +0 -0
  25. data/app/assets/javascripts/ish_manager/jquery-ui-1.12.1/jquery-ui.js +1 -1
  26. data/app/assets/javascripts/ish_manager/jquery-ui-1.12.1/jquery-ui.min.css +1 -1
  27. data/app/assets/javascripts/ish_manager/jquery-ui-1.12.1/jquery-ui.min.js +1 -1
  28. data/app/assets/javascripts/ish_manager/jquery-ui-1.12.1/jquery-ui.structure.min.css +1 -1
  29. data/app/assets/javascripts/ish_manager/jquery-ui-1.12.1/jquery-ui.theme.min.css +1 -1
  30. data/app/assets/javascripts/ish_manager/jquery-ui-1.12.1.zip +0 -0
  31. data/app/assets/javascripts/ish_manager/jquery-ui.min.js +1 -1
  32. data/app/assets/javascripts/ish_manager/shared.js +1 -1
  33. data/app/assets/stylesheets/ish_manager/{application.css → application.scss} +96 -93
  34. data/app/assets/stylesheets/ish_manager/maps.scss +8 -1
  35. data/app/assets/stylesheets/ish_manager/reset.css +1 -1
  36. data/app/assets/stylesheets/ish_manager/trash/bootstrap.min.css +1 -1
  37. data/app/assets/stylesheets/ish_manager/trash/bootstrap.min.css.map +1 -1
  38. data/app/assets/stylesheets/ish_manager/user_profiles.scss +1 -1
  39. data/app/assets/stylesheets/ish_manager/utils.scss +3 -3
  40. data/app/assets/stylesheets/ish_manager/videos.scss +6 -0
  41. data/app/controllers/ish_manager/application_controller.rb +5 -5
  42. data/app/controllers/ish_manager/features_controller.rb +7 -7
  43. data/app/controllers/ish_manager/galleries_controller.rb +1 -1
  44. data/app/controllers/ish_manager/maps_controller.rb +4 -2
  45. data/app/controllers/ish_manager/markers_controller.rb +1 -7
  46. data/app/controllers/ish_manager/newsitems_controller.rb +57 -96
  47. data/app/controllers/ish_manager/photos_controller.rb +4 -4
  48. data/app/controllers/ish_manager/reports_controller.rb +39 -71
  49. data/app/controllers/ish_manager/tags_controller.rb +40 -37
  50. data/app/controllers/ish_manager/user_profiles_controller.rb +13 -1
  51. data/app/mailers/ish_manager/application_mailer.rb +1 -1
  52. data/app/views/ish_manager/application/_main_footer.haml +3 -3
  53. data/app/views/ish_manager/application/_main_header.haml +1 -1
  54. data/app/views/ish_manager/application/_main_header_admin.haml +34 -39
  55. data/app/views/ish_manager/application/_main_header_guy.haml +1 -1
  56. data/app/views/ish_manager/application/_main_header_manager.haml +1 -1
  57. data/app/views/ish_manager/cities/_form.haml +5 -5
  58. data/app/views/ish_manager/cities/edit_feature.haml +1 -1
  59. data/app/views/ish_manager/cities/index.haml +2 -2
  60. data/app/views/ish_manager/cities/show.haml +15 -15
  61. data/app/views/ish_manager/events/_form.haml +7 -7
  62. data/app/views/ish_manager/features/_form.haml +6 -6
  63. data/app/views/ish_manager/features/_index.haml +42 -28
  64. data/app/views/ish_manager/features/_index.haml-trash +36 -0
  65. data/app/views/ish_manager/features/_item.haml +1 -1
  66. data/app/views/ish_manager/features/index.haml +4 -25
  67. data/app/views/ish_manager/galleries/_form.haml +17 -17
  68. data/app/views/ish_manager/galleries/_index.haml +3 -4
  69. data/app/views/ish_manager/galleries/_index_thumbs.haml +1 -1
  70. data/app/views/ish_manager/galleries/_menu.haml +1 -1
  71. data/app/views/ish_manager/galleries/_thumbs.haml +1 -1
  72. data/app/views/ish_manager/galleries/_title.haml +2 -2
  73. data/app/views/ish_manager/galleries/show.haml +3 -3
  74. data/app/views/ish_manager/invoices/index.haml +1 -1
  75. data/app/views/ish_manager/invoices/new.haml +1 -1
  76. data/app/views/ish_manager/leads/new.haml +1 -1
  77. data/app/views/ish_manager/maps/_form.haml +20 -5
  78. data/app/views/ish_manager/maps/_index_item.haml +8 -0
  79. data/app/views/ish_manager/maps/_map_meta_row.haml +10 -9
  80. data/app/views/ish_manager/maps/edit.haml +2 -1
  81. data/app/views/ish_manager/maps/index.haml +5 -3
  82. data/app/views/ish_manager/maps/show.haml +1 -4
  83. data/app/views/ish_manager/markers/_form.haml +16 -16
  84. data/app/views/ish_manager/newsitems/_form.haml +45 -35
  85. data/app/views/ish_manager/newsitems/_index.haml +23 -34
  86. data/app/views/ish_manager/newsitems/_item.haml +8 -8
  87. data/app/views/ish_manager/newsitems/edit.haml +11 -10
  88. data/app/views/ish_manager/photos/_meta.haml +1 -1
  89. data/app/views/ish_manager/reports/_form.haml +24 -14
  90. data/app/views/ish_manager/reports/_index.haml +1 -1
  91. data/app/views/ish_manager/reports/new.haml +1 -1
  92. data/app/views/ish_manager/reports/show.haml +2 -1
  93. data/app/views/ish_manager/sites/_header.haml +8 -3
  94. data/app/views/ish_manager/sites/galleries.haml +1 -1
  95. data/app/views/ish_manager/sites/index.haml +1 -1
  96. data/app/views/ish_manager/sites/show.haml +4 -4
  97. data/app/views/ish_manager/stock_watches/_form.haml +1 -1
  98. data/app/views/ish_manager/tags/_features.haml +2 -2
  99. data/app/views/ish_manager/tags/_form.haml +12 -16
  100. data/app/views/ish_manager/tags/_list.haml +1 -1
  101. data/app/views/ish_manager/tags/_list_simple.haml +1 -1
  102. data/app/views/ish_manager/tags/_meta.haml +9 -0
  103. data/app/views/ish_manager/tags/edit.haml +1 -1
  104. data/app/views/ish_manager/tags/show.haml +8 -12
  105. data/app/views/ish_manager/user_profiles/_form.haml +42 -29
  106. data/app/views/ish_manager/user_profiles/index.haml +15 -10
  107. data/app/views/ish_manager/user_profiles/new.haml +1 -1
  108. data/app/views/ish_manager/venues/_form.haml +19 -16
  109. data/app/views/ish_manager/venues/_index.haml +1 -1
  110. data/app/views/ish_manager/videos/_embed.erb +1 -1
  111. data/app/views/ish_manager/videos/_form.haml +8 -8
  112. data/app/views/ish_manager/videos/_index.haml +25 -25
  113. data/app/views/ish_manager/videos/_index_title.haml +2 -2
  114. data/app/views/layouts/ish_manager/application.haml +1 -1
  115. data/app/views/layouts/ish_manager/application_no_materialize.haml +2 -2
  116. data/config/routes.rb +1 -1
  117. data/lib/ish_manager.rb +1 -1
  118. metadata +7 -3
@@ -6,4 +6,4 @@
6
6
  ul li {
7
7
  list-style-type: circle;
8
8
  }
9
- }
9
+ }
@@ -14,13 +14,13 @@ ul:not(.browser-default).bullets, {
14
14
  align-content: flex-start;
15
15
 
16
16
  height: 3em;
17
- line-height: 3em;
17
+ line-height: 3em;
18
18
 
19
19
  width: 100%;
20
- margin: 0 0 1em 0;
20
+ margin: 1em 0 0 0;
21
21
  padding: 0;
22
22
 
23
23
  > * {
24
24
  padding-right: 1em;
25
25
  }
26
- }
26
+ }
@@ -0,0 +1,6 @@
1
+
2
+ .videos--index {
3
+ .item {
4
+ margin-bottom: 3em;
5
+ }
6
+ }
@@ -26,15 +26,15 @@ module IshManager
26
26
 
27
27
  def set_lists
28
28
  @cities_list = City.list
29
+ @galleries_list = Gallery.all.list
29
30
  @locations_list = ::Gameui::Map.list
31
+ @maps_list = ::Gameui::Map.list
32
+ @reports_list = Report.all.list
30
33
  @sites_list = Site.all.list
34
+ @tags_list = Tag.list
35
+ @user_profiles_list = IshModels::UserProfile.all.list
31
36
  @venues_list = Venue.all.list
32
-
33
- @reports_list = Report.all.list
34
- @galleries_list = Gallery.all.list
35
37
  @videos_list = Video.all.list
36
- @user_profiles_list = IshModels::UserProfile.all.list
37
- @tags_list = Tag.list
38
38
  end
39
39
 
40
40
  def access_denied exception
@@ -2,7 +2,7 @@
2
2
  class IshManager::FeaturesController < IshManager::ApplicationController
3
3
 
4
4
  before_action :set_lists
5
-
5
+
6
6
  def new
7
7
  if params[:city_id]
8
8
  @city = City.find params[:city_id]
@@ -70,7 +70,7 @@ class IshManager::FeaturesController < IshManager::ApplicationController
70
70
  @feature = @tag.features.find params[:id]
71
71
  authorize! :edit_feature, @tag
72
72
  end
73
-
73
+
74
74
  if params[:venue_id]
75
75
  @venue = Tag.find params[:venue_id]
76
76
  @feature = @venue.features.find params[:id]
@@ -81,13 +81,13 @@ class IshManager::FeaturesController < IshManager::ApplicationController
81
81
 
82
82
  def update
83
83
  unless params[:city_id].blank?
84
- @city = City.find params[:city_id]
84
+ @city = City.find params[:city_id]
85
85
  authorize! :update_feature, @city
86
86
  @feature = @city.features.find params[:id]
87
87
  redirect_path = city_path( @city )
88
88
  end
89
89
  unless params[:site_id].blank?
90
- @site = Site.find params[:site_id]
90
+ @site = Site.find params[:site_id]
91
91
  authorize! :update_feature, @site
92
92
  @feature = @site.features.find params[:id]
93
93
  redirect_path = site_path( @site )
@@ -98,7 +98,7 @@ class IshManager::FeaturesController < IshManager::ApplicationController
98
98
  @feature = @tag.features.find params[:id]
99
99
  redirect_path = tag_path( @tag )
100
100
  end
101
-
101
+
102
102
  authorize! :update, @feature
103
103
 
104
104
  if @feature.update_attributes params[:feature].permit!
@@ -111,7 +111,7 @@ class IshManager::FeaturesController < IshManager::ApplicationController
111
111
  else
112
112
  flash[:alert] = 'No Luck. ' + @feature.errors.messages
113
113
  render :action => :edit
114
- end
114
+ end
115
115
  end
116
116
 
117
117
  def index
@@ -145,6 +145,6 @@ class IshManager::FeaturesController < IshManager::ApplicationController
145
145
  end
146
146
  redirect_to request.referrer
147
147
  end
148
-
148
+
149
149
  end
150
150
 
@@ -83,7 +83,7 @@ class IshManager::GalleriesController < IshManager::ApplicationController
83
83
 
84
84
  def show
85
85
  begin
86
- @gallery = Gallery.unscoped.find_by :galleryname => params[:id]
86
+ @gallery = Gallery.unscoped.find_by :slug => params[:id]
87
87
  rescue
88
88
  @gallery = Gallery.unscoped.find params[:id]
89
89
  end
@@ -5,8 +5,8 @@ class IshManager::MapsController < IshManager::ApplicationController
5
5
 
6
6
  def index
7
7
  authorize! :index, ::Gameui::Map
8
- @maps = ::Gameui::Map.where( parent_slug: "" )
9
- @all_maps = Gameui::Map.all
8
+ @maps = ::Gameui::Map.where( parent_slug: "" ).order( slug: :asc )
9
+ @all_maps = Gameui::Map.all.order( slug: :asc )
10
10
  end
11
11
 
12
12
  def show
@@ -54,6 +54,8 @@ class IshManager::MapsController < IshManager::ApplicationController
54
54
  @map.image = image
55
55
  end
56
56
 
57
+ @map.config = JSON.parse map_params[:config]
58
+
57
59
  respond_to do |format|
58
60
  if map_params[:parent_slug].present?
59
61
  @map.parent = ::Gameui::Map.find_by({ slug: map_params[:parent_slug] })
@@ -4,12 +4,6 @@ class IshManager::MarkersController < IshManager::ApplicationController
4
4
  before_action :set_map, except: [ :destroy, :edit, :update ]
5
5
  before_action :set_marker, only: [ :edit, :update ]
6
6
 
7
- =begin
8
- def index
9
- authorize! :markers, ::Gameui::Map
10
- end
11
- =end
12
-
13
7
  def new
14
8
  authorize! :new_marker, ::Gameui::Map
15
9
  @marker = ::Gameui::Marker.new
@@ -59,7 +53,7 @@ class IshManager::MarkersController < IshManager::ApplicationController
59
53
  respond_to do |format|
60
54
  if @marker.update(marker_params)
61
55
  @marker.map.touch
62
- format.html { redirect_to maps_path(@map), notice: 'Marker was successfully updated.' }
56
+ format.html { redirect_to location_map_editor_path(@map.id), notice: 'Marker was successfully updated.' }
63
57
  else
64
58
  format.html { render :edit }
65
59
  end
@@ -1,28 +1,7 @@
1
1
  class IshManager::NewsitemsController < IshManager::ApplicationController
2
2
  before_action :set_lists
3
3
 
4
- def new
5
- @newsitem = Newsitem.new
6
-
7
- @cities_list = City.list
8
- @maps_list = ::Gameui::Map.list
9
- @sites_list = Site.list
10
- @tags_list = Tag.list
11
-
12
- if params[:city_id]
13
- @city = City.find params[:city_id]
14
- @newsitem.city = @city
15
- end
16
- if params[:site_id]
17
- @site = Site.find params[:site_id]
18
- @newsitem.site = @site
19
- end
20
- if params[:tag_id]
21
- @tag = Tag.unscoped.find params[:tag_id]
22
- @newsitem.tag = @tag
23
- end
24
- authorize! :new, @newsitem
25
- end
4
+ ## Alphabetized : )
26
5
 
27
6
  def create
28
7
  @newsitem = Newsitem.new params[:newsitem].permit!
@@ -35,6 +14,7 @@ class IshManager::NewsitemsController < IshManager::ApplicationController
35
14
  @resource ||= IshModels::UserProfile.find params[:newsitem][:user_profile_id] if !params[:newsitem][:user_profile_id].blank?
36
15
  @resource ||= ::Gameui::Map.find params[:newsitem][:map_id] if !params[:newsitem][:map_id].blank?
37
16
  @resource.newsitems << @newsitem
17
+ @resource.touch
38
18
 
39
19
  authorize! :create_newsitem, @resource
40
20
 
@@ -46,13 +26,13 @@ class IshManager::NewsitemsController < IshManager::ApplicationController
46
26
  url = case @resource.class.name
47
27
  when "City"
48
28
  edit_city_path( @resource.id )
29
+ when "IshModels::UserProfile"
30
+ user_profiles_path
31
+ when "Site"
32
+ edit_site_path( @resource.id )
49
33
  when "Tag"
50
34
  @resource.site.touch
51
35
  tag_path( @resource.id )
52
- when "Site"
53
- edit_site_path( @resource.id )
54
- when "IshModels::UserProfile"
55
- user_profiles_path
56
36
  else
57
37
  root_path
58
38
  end
@@ -72,103 +52,84 @@ class IshManager::NewsitemsController < IshManager::ApplicationController
72
52
  end
73
53
 
74
54
  def destroy
75
- authorize! :destroy, Newsitem
76
- if params[:city_id]
77
- flag = City.find( params[:city_id] ).newsitems.find( params[:id] ).destroy
78
- url = edit_city_path( params[:city_id] )
55
+ @newsitem = Newsitem.find params[:id]
56
+ authorize! :destroy, @newsitem
57
+
58
+ if @newsitem.destroy
59
+ City.find(@newsitem.city_id).touch if @newsitem.city_id
60
+ Site.find(@newsitem.site_id).touch if @newsitem.site_id
61
+ Tag.find(@newsitem.tag_id).touch if @newsitem.tag_id
62
+
63
+ flash[:notice] = "Destroyed the newsitem."
64
+ else
65
+ flash[:alert] = "Cannot destroy the newsitem: #{@newsitem.errors.full_messages}."
79
66
  end
80
- if profile_id = params[:user_profile_id]
81
- profile = IshModels::UserProfile.find profile_id
82
- flag = profile.newsitems.find( params[:id] ).destroy
83
- url = profile_path( profile_id )
67
+
68
+ redirect_to request.referrer ? request.referrer : '/'
69
+ end
70
+
71
+ def edit
72
+ @newsitem = Newsitem.find( params[:id] )
73
+ authorize! :edit, @newsitem
74
+
75
+ ## @TODO: what on earth is this?
76
+ out = Gallery.unscoped.where( :is_trash => false, :user_profile => current_user.profile ).order_by( :created_at => :desc )
77
+ @galleries_list = [['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
78
+
79
+ end
80
+
81
+ def index
82
+ @resource = Site.find( params[:site_id] ) if params[:site_id]
83
+ @resource = City.find( params[:site_id] ) if params[:city_id]
84
+
85
+ authorize! :newsitems_index, @resource
86
+ @newsitems = @resource.newsitems
87
+ end
88
+
89
+ def new
90
+ @newsitem = Newsitem.new
91
+
92
+ if params[:city_id]
93
+ @city = City.find params[:city_id]
94
+ @newsitem.city = @city
84
95
  end
85
96
  if params[:site_id]
86
- site = Site.find( params[:site_id] )
87
- flag = site.newsitems.find( params[:id] ).destroy
88
- if flag
89
- site.touch
90
- end
91
- url = edit_site_path( params[:site_id] )
97
+ @site = Site.find params[:site_id]
98
+ @newsitem.site = @site
92
99
  end
93
100
  if params[:tag_id]
94
- tag = Tag.find( params[:tag_id] )
95
- flag = tag.newsitems.find( params[:id] ).destroy
96
- url = tag_path( params[:tag_id] )
101
+ @tag = Tag.unscoped.find params[:tag_id]
102
+ @newsitem.tag = @tag
97
103
  end
98
-
99
- flash[:notice] = "Success? #{flag.inspect}"
100
- redirect_to request.referrer ? request.referrer : '/'
104
+ authorize! :new, @newsitem
101
105
  end
102
106
 
103
107
  def update
104
- if params[:site_id] || params[:newsitem][:site_id]
105
- if params[:site_id]
106
- @site = Site.find params[:site_id]
107
- end
108
- if params[:newsitem][:site_id]
109
- @site = Site.find params[:newsitem][:site_id]
110
- end
111
- @site.touch
112
- @newsitem = @site.newsitems.find params[:id]
113
- url = edit_site_path( @site )
114
- end
108
+ @newsitem = Newsitem.find params[:id]
109
+ authorize! :update, @newsitem
110
+
111
+ ## @TODO: re-add site management here, probably.
115
112
 
116
113
  if params[:city_id]
117
114
  @city = City.find params[:city_id]
118
115
  @newsitem = @city.newsitems.find params[:id]
119
116
  url = edit_city_path( @city )
120
117
  end
118
+
121
119
  if params[:photo]
122
120
  photo = Photo.new :photo => params[:photo]
123
121
  photo.user_profile = current_user.profile
124
122
  @newsitem.photo = photo
125
123
  end
126
- authorize! :update, @newsitem
127
- flag = @newsitem.update_attributes params[:newsitem].permit!
128
124
 
125
+ flag = @newsitem.update_attributes params[:newsitem].permit!
129
126
  if flag
130
127
  flash[:notice] = 'Success'
131
128
  else
132
129
  flash[:alert] = "No Luck: #{@newsitem.errors.messages}"
133
130
  end
134
131
 
135
- redirect_to url
136
- end
137
-
138
- def edit
139
- out = Gallery.unscoped.where( :is_trash => false, :user_profile => current_user.profile ).order_by( :created_at => :desc )
140
- @galleries_list = [['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
141
-
142
- if params[:site_id]
143
- @site = Site.find params[:site_id]
144
- @newsitem = @site.newsitems.find( params[:id] )
145
- end
146
- if params[:city_id]
147
- @city = City.find params[:city_id]
148
- @newsitem = @city.newsitems.find( params[:id] )
149
- end
150
- authorize! :edit, @newsitem
151
-
152
- end
153
-
154
- def index
155
- @resource = Site.find( params[:site_id] ) if params[:site_id]
156
- @resource = City.find( params[:site_id] ) if params[:city_id]
157
-
158
- authorize! :newsitems_index, @resource
159
- @newsitems = @resource.newsitems
160
- end
161
-
162
- private
163
-
164
- def set_lists
165
- @videos_list = Video.list
166
- @galleries_list = Gallery.list
167
- @reports_list = Report.list
168
- @sites_list = Site.list
169
- @cities_list = City.list
170
- @tags_list = Tag.list
171
- @user_profiles_list = IshModels::UserProfile.list
132
+ redirect_to edit_newsitem_path(@newsitem)
172
133
  end
173
134
 
174
135
  end
@@ -30,12 +30,12 @@ class IshManager::PhotosController < IshManager::ApplicationController
30
30
 
31
31
  def j_create
32
32
  # find this gallery
33
- if params[:galleryname]
34
- gallery = Gallery.unscoped.where( :galleryname => params[:galleryname] ).first
35
- gallery ||= Gallery.unscoped.find params[:galleryname]
33
+ if params[:slug]
34
+ gallery = Gallery.unscoped.where( :slug => params[:slug] ).first
35
+ gallery ||= Gallery.unscoped.find params[:slug]
36
36
  elsif params[:gallery_id] # this one, let's normalize on id everywhere in manager.
37
37
  gallery = Gallery.unscoped.find( params[:gallery_id] )
38
- gallery ||= Gallery.unscoped.where( :galleryname => params[:gallery_id] ).first
38
+ gallery ||= Gallery.unscoped.where( :slug => params[:gallery_id] ).first
39
39
  end
40
40
  authorize! :create_photo, gallery
41
41
 
@@ -3,11 +3,48 @@ class IshManager::ReportsController < IshManager::ApplicationController
3
3
 
4
4
  before_action :set_lists
5
5
 
6
+ def create
7
+ @report = Report.new params[:report].permit!
8
+ @report.user_profile = current_user.profile # @TODO: this should not be hard-coded
9
+ authorize! :create, @report
10
+
11
+ flag = @report.save
12
+ respond_to do |format|
13
+ if flag
14
+
15
+ ## @TODO: I'm sure there is a better way
16
+ if params[:report][:photo]
17
+ photo = Photo.new
18
+ photo.photo = params[:report][:photo]
19
+ photo.is_public = @report.is_public
20
+ photo.is_trash = false
21
+ photo.report_id = @report.id
22
+ photo.save
23
+ end
24
+
25
+ format.html do
26
+ redirect_to report_path(@report), :notice => 'Report was successfully created.'
27
+ end
28
+ format.json { render :json => @report, :status => :created, :location => @report } # TODO: remove, I got the api now.
29
+ else
30
+ format.html do
31
+ flash[:alert] = @report.errors.full_messages
32
+ @tags_list = Tag.all.list
33
+ @sites_list = Site.all.list
34
+ @cities_list = City.all.list
35
+
36
+ render :action => "new"
37
+ end
38
+ format.json { render :json => @report.errors, :status => :unprocessable_entity } # @TODO: remove, right? no api here.
39
+ end
40
+ end
41
+ end
42
+
6
43
  def index
7
44
  authorize! :index, Report
8
- @reports = Report.unscoped.order_by( :created_at => :desc
45
+ @reports = Report.unscoped.order_by( :created_at => :desc
9
46
  ).where( :is_trash => false, :user_profile => current_user.profile
10
- ).page( params[:reports_page]
47
+ ).page( params[:reports_page]
11
48
  ).per( Report::PER_PAGE )
12
49
  if false === params[:site]
13
50
  @reports = @reports.where( :site_id => nil )
@@ -74,76 +111,7 @@ class IshManager::ReportsController < IshManager::ApplicationController
74
111
  end
75
112
  end
76
113
 
77
- def create
78
- @report = Report.new params[:report].permit!
79
- @report.user_profile = current_user.profile
80
- authorize! :create, @report
81
-
82
- @site = Site.where( :id => params[:report][:site_id] ).first
83
- @site ||= Site.find_by :domain => 'piousbox.com', :lang => :en
84
-
85
- if @site
86
- redirect_path = site_reports_path( @site.id )
87
- end
88
- if params[:report][:city_id]
89
- redirect_path = city_path( params[:report][:city_id] )
90
- end
91
-
92
- # @report.user = @current_user || User.where( :username => 'anon' ).first
93
- # @report.username = @report.user.username
94
- @report[:lang] = @locale
95
- @report.name_seo ||= @report.id
96
- @report.is_feature = false
97
- @report.site = @site
98
-
99
- saved = @report.save
100
-
101
- respond_to do |format|
102
- if saved
103
-
104
- if params[:report][:photo]
105
- # photo
106
- photo = Photo.new
107
- photo.photo = params[:report][:photo]
108
- # photo.user = @report.user
109
- photo.is_public = @report.is_public
110
- photo.is_trash = false
111
- photo.report_id = @report.id
112
- photo.save
113
- end
114
-
115
- # for homepage
116
- # @TODO: move this to the model
117
- if @report.is_public
118
- n = Newsitem.new
119
- n.report = @report
120
- n.descr = @report.subhead
121
- # n.user = @report.user
122
- @site.newsitems << n
123
- @site.touch
124
- if @site.save
125
- else
126
- flash[:alert] = (flash[:alert]||'') + 'City could not be saved (newsitem). '
127
- end
128
- end
129
-
130
- format.html do
131
- redirect_to redirect_path, :notice => 'Report was successfully created (but newsitem, no information).'
132
- end
133
- format.json { render :json => @report, :status => :created, :location => @report }
134
- else
135
- format.html do
136
- flash[:alert] = @report.errors.messages
137
- @tags_list = Tag.all.where( :is_public => true ).list
138
- @sites_list = Site.all.list
139
- @cities_list = City.all.list
140
114
 
141
- render :action => "new"
142
- end
143
- format.json { render :json => @report.errors, :status => :unprocessable_entity }
144
- end
145
- end
146
- end
147
115
 
148
116
  end
149
117
 
@@ -3,6 +3,39 @@ class IshManager::TagsController < IshManager::ApplicationController
3
3
 
4
4
  before_action :set_lists
5
5
 
6
+ # alphabetized : )
7
+
8
+ def create
9
+ @tag = Tag.create params[:tag].permit!
10
+ authorize! :create, @tag
11
+ if @tag.save
12
+ do_touch
13
+ flash[:notice] = 'Success.'
14
+ redirect_to tags_path
15
+ else
16
+ puts! @tag.errors, "error creating tag."
17
+ flash[:alert] = "No luck. #{@tag.errors.full_messages}"
18
+ render action: 'new'
19
+ end
20
+ end
21
+
22
+ def destroy
23
+ @tag = Tag.unscoped.find params[:id]
24
+ authorize! :destroy, @tag
25
+ if @tag.destroy
26
+ do_touch
27
+ flash[:notice] = 'Success'
28
+ else
29
+ flash[:alert] = "Cannot destroy tag: #{@tag.errors.messages}"
30
+ end
31
+ redirect_to :action => 'index'
32
+ end
33
+
34
+ def edit
35
+ @tag = Tag.unscoped.find params[:id]
36
+ authorize! :edit, @tag
37
+ end
38
+
6
39
  def index
7
40
  @resource = City.find( params[:city_id] ) if params[:city_id]
8
41
 
@@ -14,16 +47,8 @@ class IshManager::TagsController < IshManager::ApplicationController
14
47
 
15
48
  authorize! :index, Tag.new
16
49
 
17
- @site = Site.find( params[:site_id] ) if params[:site_id]
18
- @city = City.find( params[:city_id] ) if params[:city_id]
19
- end
20
-
21
- def show
22
- @tag = Tag.unscoped.find params[:id]
23
- authorize! :show, @tag
24
-
25
- @galleries = @tag.galleries.unscoped.where( :is_trash => false ).page( params[:galleries_page] ).per( 10 )
26
- @videos = @tag.videos.unscoped.where( :is_trash => false ).page( params[:videos_page ]).per( 10 )
50
+ @site = Site.find( params[:site_id] ) if params[:site_id]
51
+ @city = City.find( params[:city_id] ) if params[:city_id]
27
52
  end
28
53
 
29
54
  def new
@@ -31,23 +56,12 @@ class IshManager::TagsController < IshManager::ApplicationController
31
56
  authorize! :new, @tag
32
57
  end
33
58
 
34
- def create
35
- @tag = Tag.create params[:tag].permit!
36
- authorize! :create, @tag
37
- if @tag.save
38
- do_touch
39
- flash[:notice] = 'Success.'
40
- redirect_to tags_path
41
- else
42
- puts! @tag.errors, "error creating tag."
43
- flash[:alert] = "No luck. #{@tag.errors.messages}"
44
- render :action => :new
45
- end
46
- end
47
-
48
- def edit
59
+ def show
49
60
  @tag = Tag.unscoped.find params[:id]
50
- authorize! :edit, @tag
61
+ authorize! :show, @tag
62
+
63
+ @galleries = @tag.galleries.unscoped.where( :is_trash => false ).page( params[:galleries_page] ).per( 10 )
64
+ @videos = @tag.videos.unscoped.where( :is_trash => false ).page( params[:videos_page ]).per( 10 )
51
65
  end
52
66
 
53
67
  def update
@@ -64,17 +78,6 @@ class IshManager::TagsController < IshManager::ApplicationController
64
78
  end
65
79
  end
66
80
 
67
- def destroy
68
- @tag = Tag.unscoped.find params[:id]
69
- authorize! :destroy, @tag
70
- if @tag.destroy
71
- do_touch
72
- flash[:notice] = 'Success'
73
- else
74
- flash[:alert] = "Cannot destroy tag: #{@tag.errors.messages}"
75
- end
76
- redirect_to :action => 'index'
77
- end
78
81
 
79
82
  private
80
83
 
@@ -22,11 +22,17 @@ class IshManager::UserProfilesController < IshManager::ApplicationController
22
22
  @profile = IshModels::UserProfile.find params[:id]
23
23
  authorize! :update, @profile
24
24
 
25
+ if params[:photo]
26
+ photo = Photo.new :photo => params[:photo]
27
+ @profile.profile_photo = photo
28
+ end
29
+
25
30
  flag = @profile.update_attributes params[:profile].permit!
31
+
26
32
  if flag
27
33
  flash[:notice] = "Updated profile #{@profile.email}"
28
34
  else
29
- flash[:alert] = "Cannot update profile: #{pp_errors @profile.errors.messages}"
35
+ flash[:alert] = "Cannot update profile: #{@profile.errors.full_messages}"
30
36
  end
31
37
  if params[:redirect_to]
32
38
  redirect_to params[:redirect_to]
@@ -45,6 +51,12 @@ class IshManager::UserProfilesController < IshManager::ApplicationController
45
51
  @user.password ||= (0...12).map { rand(100) }.join
46
52
  @user.profile = IshModels::UserProfile.new params[:profile].permit!
47
53
  authorize! :create, @user.profile
54
+
55
+ if params[:photo]
56
+ photo = Photo.new :photo => params[:photo]
57
+ @profile.profile_photo = photo
58
+ end
59
+
48
60
  if !@user.save
49
61
  raise "cannot save profile.user: #{@profile.user.errors.full_messages} profile errors: #{@profile.errors.full_messages}"
50
62
  end
@@ -20,7 +20,7 @@ module IshManager
20
20
  @gallery = gallery
21
21
  @domain = Rails.application.config.action_mailer.default_url_options[:host]
22
22
  @galleries_path = IshManager::Engine.routes.url_helpers.galleries_path
23
- @gallery_path = IshManager::Engine.routes.url_helpers.gallery_path(@gallery.galleryname)
23
+ @gallery_path = IshManager::Engine.routes.url_helpers.gallery_path(@gallery.slug)
24
24
  mail( :to => '314658@gmail.com',
25
25
  :bcc => profiles.map { |p| p.email },
26
26
  :subject => 'You got new shared galleries on pi manager' ).deliver