ish_manager 0.1.8.322 → 0.1.8.324

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/ish_manager/application.scss +5 -0
  3. data/app/assets/stylesheets/ish_manager/email_templates.scss +2 -1
  4. data/app/assets/stylesheets/ish_manager/galleries.scss +1 -1
  5. data/app/assets/stylesheets/ish_manager/maps.scss +10 -0
  6. data/app/controllers/ish_manager/application_controller.rb +0 -8
  7. data/app/controllers/ish_manager/email_campaigns_controller.rb +2 -2
  8. data/app/controllers/ish_manager/email_contexts_controller.rb +26 -5
  9. data/app/controllers/ish_manager/galleries_controller.rb +3 -5
  10. data/app/controllers/ish_manager/leads_controller.rb +2 -2
  11. data/app/controllers/ish_manager/maps_controller.rb +13 -12
  12. data/app/controllers/ish_manager/markers_controller.rb +1 -1
  13. data/app/controllers/ish_manager/newsitems_controller.rb +9 -47
  14. data/app/controllers/ish_manager/photos_controller.rb +1 -3
  15. data/app/controllers/ish_manager/reports_controller.rb +2 -2
  16. data/app/controllers/ish_manager/user_profiles_controller.rb +7 -7
  17. data/app/controllers/ish_manager/videos_controller.rb +2 -29
  18. data/app/helpers/ish_manager/application_helper.rb +2 -16
  19. data/app/models/ish_manager/ability.rb +4 -2
  20. data/app/views/ish_manager/application/_main_header_guy.haml +3 -3
  21. data/app/views/ish_manager/application/_paginate.haml +4 -0
  22. data/app/views/ish_manager/email_contexts/index.haml +20 -14
  23. data/app/views/ish_manager/{unsubscribes → email_unsubscribes}/new.haml +0 -0
  24. data/app/views/ish_manager/galleries/_form.haml +0 -4
  25. data/app/views/ish_manager/maps/_form.haml +9 -6
  26. data/app/views/ish_manager/markers/_form.haml +9 -0
  27. data/app/views/ish_manager/markers/_index.haml +7 -3
  28. data/app/views/ish_manager/newsitems/_form.haml +0 -6
  29. data/app/views/ish_manager/newsitems/_item.haml +0 -7
  30. data/app/views/ish_manager/newsitems/edit.haml +1 -10
  31. data/app/views/ish_manager/newsitems/index.haml +1 -7
  32. data/app/views/ish_manager/newsitems/new.haml +0 -4
  33. data/app/views/ish_manager/reports/_form.haml +0 -4
  34. data/app/views/ish_manager/reports/_index.haml +2 -5
  35. data/app/views/ish_manager/user_profiles/_form.haml +0 -4
  36. data/app/views/ish_manager/user_profiles/edit.haml +2 -3
  37. data/app/views/ish_manager/user_profiles/index.haml +1 -1
  38. data/app/views/ish_manager/videos/_form.haml +0 -6
  39. data/app/views/ish_manager/videos/_list.haml +1 -1
  40. data/app/views/ish_manager/videos/show.haml +1 -1
  41. data/config/routes.rb +2 -0
  42. metadata +14 -82
  43. data/app/controllers/ish_manager/trash/cities_controller.rb +0 -107
  44. data/app/controllers/ish_manager/trash/orders_controller.rb +0 -12
  45. data/app/controllers/ish_manager/trash/sites_controller.rb +0 -95
  46. data/app/controllers/ish_manager/trash/tags_controller.rb +0 -91
  47. data/app/controllers/ish_manager/trash/users_controller.rb +0 -15
  48. data/app/controllers/ish_manager/trash/venues_controller.rb +0 -72
  49. data/app/views/ish_manager/features/_form.haml +0 -70
  50. data/app/views/ish_manager/features/_index.haml +0 -43
  51. data/app/views/ish_manager/features/_item.haml +0 -16
  52. data/app/views/ish_manager/features/edit.haml +0 -7
  53. data/app/views/ish_manager/features/index.haml +0 -5
  54. data/app/views/ish_manager/features/new.haml +0 -11
  55. data/app/views/ish_manager/features/show.haml +0 -0
  56. data/app/views/ish_manager/markers/_index_small.haml-trash +0 -28
  57. data/app/views/ish_manager/tags/_features.haml +0 -12
  58. data/app/views/ish_manager/tags/_form.haml +0 -44
  59. data/app/views/ish_manager/tags/_index.haml +0 -16
  60. data/app/views/ish_manager/tags/_item.haml +0 -16
  61. data/app/views/ish_manager/tags/_list.haml +0 -8
  62. data/app/views/ish_manager/tags/_list_simple.haml +0 -5
  63. data/app/views/ish_manager/tags/_meta.haml +0 -9
  64. data/app/views/ish_manager/tags/edit.haml +0 -4
  65. data/app/views/ish_manager/tags/index.haml +0 -22
  66. data/app/views/ish_manager/tags/new.haml +0 -3
  67. data/app/views/ish_manager/tags/show.haml +0 -23
  68. data/app/views/ish_manager/trash/cities/_form.haml +0 -38
  69. data/app/views/ish_manager/trash/cities/_header.haml +0 -39
  70. data/app/views/ish_manager/trash/cities/edit.haml +0 -4
  71. data/app/views/ish_manager/trash/cities/edit_feature.haml +0 -4
  72. data/app/views/ish_manager/trash/cities/index.haml +0 -27
  73. data/app/views/ish_manager/trash/cities/new.haml +0 -5
  74. data/app/views/ish_manager/trash/cities/new_feature.haml +0 -5
  75. data/app/views/ish_manager/trash/cities/new_newsitem.haml +0 -23
  76. data/app/views/ish_manager/trash/cities/show.haml +0 -63
  77. data/app/views/ish_manager/trash/events/_form.haml +0 -45
  78. data/app/views/ish_manager/trash/events/_index.haml +0 -18
  79. data/app/views/ish_manager/trash/events/edit.haml +0 -2
  80. data/app/views/ish_manager/trash/events/index.haml +0 -2
  81. data/app/views/ish_manager/trash/events/new.haml +0 -2
  82. data/app/views/ish_manager/trash/meeting_mailer/README.txt +0 -5
  83. data/app/views/ish_manager/trash/sites/_form.haml +0 -63
  84. data/app/views/ish_manager/trash/sites/_header.haml +0 -21
  85. data/app/views/ish_manager/trash/sites/edit.haml +0 -3
  86. data/app/views/ish_manager/trash/sites/galleries.haml +0 -19
  87. data/app/views/ish_manager/trash/sites/index.haml +0 -26
  88. data/app/views/ish_manager/trash/sites/new.haml +0 -4
  89. data/app/views/ish_manager/trash/sites/show.haml +0 -18
  90. data/app/views/ish_manager/trash/venues/_form.haml +0 -43
  91. data/app/views/ish_manager/trash/venues/_index.haml +0 -13
  92. data/app/views/ish_manager/trash/venues/_search.haml +0 -7
  93. data/app/views/ish_manager/trash/venues/edit.haml +0 -5
  94. data/app/views/ish_manager/trash/venues/index.haml +0 -9
  95. data/app/views/ish_manager/trash/venues/new.haml +0 -5
  96. data/app/views/ish_manager/trash/venues/show.haml +0 -2
  97. data/app/views/layouts/ish_manager/application.haml-trash +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f685b8fe37214d8a572e315c280446e97c5c4b03cc005d881a167ad41d9fb320
4
- data.tar.gz: f83dc62a1e6373c87d29918efc457f43a2bc0b997d77d3a23444b9cdace9704c
3
+ metadata.gz: 1da86313247de5bc93474fca04c1bda79f5f7a216b646a7fcbe12b1e1630e7ba
4
+ data.tar.gz: ba2136ba6f172f25d71736a29e36b1c8373362b961074b7f1980f7fee45d82c3
5
5
  SHA512:
6
- metadata.gz: b49d5ef8d417871ce7f82dd62b824756640cd4f77fa838015f6ae8ab5db7b7ef68f6469197bf6f7c811203ca0afe3bd6d2272fb32d8294a92445b40384cf0ee4
7
- data.tar.gz: a891419ec414ac3fd995c1df5556a769aac1ab1d15ca0ae7fd9f2b1266518bacf7dfee531c7835702b0a29eda5890a2c2a4a419a7aafcad98b1cd93a72940e5c
6
+ metadata.gz: 84ad3c8788c0413a0cfe78ab5be3d9837b877cee28f04690ad467201f9eb55e79698fbbb1a784a1cd0ad8cb2b6364c35c48336da2af3bec446ae96644fb24e64
7
+ data.tar.gz: a8f1e342dad907e730b461ab0e8e508175e4b03e80b56db53c19ee07e310b71b5aa64f63ff0d7e46f40de206ac9284ed00c41bc221a8ff991c8a8f37979f7b5e
@@ -192,6 +192,7 @@ ul.inline li {
192
192
  /* L */
193
193
  textarea.large {
194
194
  height: 400px;
195
+ width: 100%;
195
196
  }
196
197
 
197
198
  .large-photos img {
@@ -242,6 +243,10 @@ textarea.large {
242
243
  background: url('//d15g8hc4183yn4.cloudfront.net/wp-content/uploads/2022/10/05192822/weather-bg-development.png');
243
244
  }
244
245
 
246
+ .manager--main-footer {
247
+ border-top: 2px solid red;
248
+ }
249
+
245
250
  .menu-secondary {
246
251
  margin: 20px 0;
247
252
  padding: 0;
@@ -17,7 +17,8 @@
17
17
  }
18
18
 
19
19
  .email-templates-index ul li,
20
- .email-contexts-index {
20
+ .email-contexts-index .header,
21
+ .email-contexts-index ul.main li {
21
22
 
22
23
  a {
23
24
  margin-right: 0.5em;
@@ -8,7 +8,7 @@
8
8
  // text-align: center;
9
9
  }
10
10
 
11
- .galleries-show {
11
+ div.galleries-show {
12
12
  > * {
13
13
  border-bottom: 2px solid red;
14
14
  }
@@ -2,6 +2,16 @@
2
2
  * Alphabetized : )
3
3
  **/
4
4
 
5
+ .is_active {
6
+ }
7
+ .not_is_active {
8
+ color: #ccc;
9
+ }
10
+
11
+ .not_is_3d {
12
+ text-decoration: line-through;
13
+ }
14
+
5
15
  .maps--map-meta-row {
6
16
  .flat-row {
7
17
  display: flex;
@@ -63,14 +63,6 @@ module IshManager
63
63
  else
64
64
  flash[:alert] = "No Luck. #{@photo.errors.messages} #{@resource.errors.messages}"
65
65
  end
66
- # redirect_to resource_path( @resource )
67
- end
68
-
69
- def resource_path resource
70
- case resource.class.name
71
- when 'Event'
72
- event_path( resource.id )
73
- end
74
66
  end
75
67
 
76
68
  end
@@ -3,7 +3,7 @@ class ::IshManager::EmailCampaignsController < IshManager::ApplicationController
3
3
 
4
4
  def index
5
5
  authorize! :index, Ish::Campaign
6
- @campaigns = Ish::Campaign.where( :profile => current_user.profile, :is_trash => false )
6
+ @campaigns = Ish::Campaign.where( :profile => @current_profile, :is_trash => false )
7
7
  if params[:is_done]
8
8
  @campaigns = @campaigns.where( :is_done => true )
9
9
  else
@@ -18,7 +18,7 @@ class ::IshManager::EmailCampaignsController < IshManager::ApplicationController
18
18
 
19
19
  def create
20
20
  @campaign = Ish::Campaign.new params[:campaign].permit!
21
- @campaign.profile = current_user.profile
21
+ @campaign.profile = @current_profile
22
22
  authorize! :create, @campaign
23
23
  if @campaign.save
24
24
  flash[:notice] = "created campaign"
@@ -1,6 +1,8 @@
1
1
 
2
2
  class ::IshManager::EmailContextsController < ::IshManager::ApplicationController
3
3
 
4
+ # alphabetized : )
5
+
4
6
  before_action :set_lists
5
7
 
6
8
  def create
@@ -17,6 +19,18 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
17
19
  end
18
20
  end
19
21
 
22
+ def destroy
23
+ @email_ctx = EmailContext.find params[:id]
24
+ authorize! :destroy, @email_ctx
25
+ flag = @email_ctx.destroy
26
+ if flag
27
+ flash[:notice] = 'Destroyed the email context'
28
+ else
29
+ flash[:alert] = 'Could not destroy email context'
30
+ end
31
+ redirect_to action: :index
32
+ end
33
+
20
34
  def do_send
21
35
  authorize! :send, ::Ish::EmailContext
22
36
  IshManager::OfficeMailer.send_context_email(params[:id]).deliver_later
@@ -25,20 +39,24 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
25
39
  end
26
40
 
27
41
  def edit
28
- authorize! :edit, ::Ish::EmailContext
29
42
  @email_ctx = ::Ish::EmailContext.find params[:id]
43
+ authorize! :edit, @email_ctx
30
44
  end
31
45
 
32
46
  def iframe_src
33
- authorize! :iframe_src, Ish::EmailContext
34
47
  @email_ctx = EmailContext.find params[:id]
48
+ authorize! :iframe_src, @email_ctx
35
49
  @email_template = @email_ctx.email_template
36
50
  render 'ish_manager/email_templates/iframe_src', layout: false
37
51
  end
38
52
 
39
53
  def index
40
54
  authorize! :index, ::Ish::EmailContext
41
- @email_ctxs = ::Ish::EmailContext.all.page( params[:contexts_page] )
55
+ @email_ctxs = ::Ish::EmailContext.all
56
+ if params[:notsent]
57
+ @email_ctxs = @email_ctxs.where( sent_at: nil )
58
+ end
59
+ @email_ctxs = @email_ctxs.page( params[Ish::EmailContext::PAGE_PARAM_NAME] )
42
60
  end
43
61
 
44
62
  def new
@@ -47,13 +65,13 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
47
65
  end
48
66
 
49
67
  def show
50
- authorize! :show, ::Ish::EmailContext
51
68
  @email_ctx = ::Ish::EmailContext.find( params[:id] )
69
+ authorize! :show, @email_ctx
52
70
  end
53
71
 
54
72
  def update
55
- authorize! :update, ::Ish::EmailContext
56
73
  @email_ctx = ::Ish::EmailContext.find params[:id]
74
+ authorize! :update, @email_ctx
57
75
  if @email_ctx.update_attributes params[:ish_email_context].permit!
58
76
  flash[:notice] = 'Saved.'
59
77
  redirect_to action: 'show', id: @email_ctx.id
@@ -65,6 +83,9 @@ class ::IshManager::EmailContextsController < ::IshManager::ApplicationControlle
65
83
  end
66
84
  end
67
85
 
86
+ #
87
+ # private
88
+ #
68
89
  private
69
90
 
70
91
  def set_lists
@@ -10,7 +10,7 @@ class IshManager::GalleriesController < IshManager::ApplicationController
10
10
  params[:gallery][:shared_profiles].delete('')
11
11
  params[:gallery][:shared_profiles] = Ish::UserProfile.find params[:gallery][:shared_profiles]
12
12
  @gallery = Gallery.new params[:gallery].permit!
13
- @gallery.user_profile = current_user.profile
13
+ @gallery.user_profile = @current_profile
14
14
  authorize! :create, @gallery
15
15
 
16
16
  if @gallery.save
@@ -42,7 +42,7 @@ class IshManager::GalleriesController < IshManager::ApplicationController
42
42
  @galleries = Gallery.unscoped.where( ## This must be so for role `guy`. _vp_ 2022-10-03
43
43
  :is_done.in => [false, nil],
44
44
  :is_trash.in => [false, nil],
45
- :user_profile => current_user.profile
45
+ :user_profile => @current_profile,
46
46
  ).order_by( :created_at => :desc )
47
47
 
48
48
  if params[:q]
@@ -78,7 +78,7 @@ class IshManager::GalleriesController < IshManager::ApplicationController
78
78
  def shared_with_me
79
79
  authorize! :index, Gallery
80
80
  @page_title = 'Galleries Shared With Me'
81
- @galleries = current_user.profile.shared_galleries.unscoped.where( :is_trash => false
81
+ @galleries = @current_profile.shared_galleries.unscoped.where( :is_trash => false
82
82
  ).order_by( :created_at => :desc
83
83
  ).page( params[:shared_galleries_page] ).per( 10 )
84
84
  render params[:render_type]
@@ -94,8 +94,6 @@ class IshManager::GalleriesController < IshManager::ApplicationController
94
94
  old_shared_profile_ids = @gallery.shared_profiles.map(&:id)
95
95
  authorize! :update, @gallery
96
96
 
97
- params[:gallery][:tag_ids].delete('') if params[:gallery][:tag_ids]
98
-
99
97
  params[:gallery][:shared_profiles].delete('')
100
98
  params[:gallery][:shared_profile_ids] = params[:gallery][:shared_profiles]
101
99
  params[:gallery].delete :shared_profiles
@@ -5,7 +5,7 @@ class ::IshManager::LeadsController < IshManager::ApplicationController
5
5
 
6
6
  def create
7
7
  @lead = Ish::Lead.new params[:lead].permit!
8
- @lead.profile = current_user.profile
8
+ @lead.profile = @current_profile
9
9
  authorize! :create, @lead
10
10
  if @lead.save
11
11
  flash[:notice] = "created lead"
@@ -22,7 +22,7 @@ class ::IshManager::LeadsController < IshManager::ApplicationController
22
22
 
23
23
  def index
24
24
  authorize! :index, Ish::Lead
25
- @leads = Ish::Lead.all # where( :profile => current_user.profile, :is_trash => false )
25
+ @leads = Ish::Lead.all # where( :profile => @current_profile, :is_trash => false )
26
26
  if params[:is_done]
27
27
  @leads = @leads.where( :is_done => true )
28
28
  else
@@ -93,11 +93,7 @@ class IshManager::MapsController < IshManager::ApplicationController
93
93
  else
94
94
  p = Profile.new({ email: profile[:email], _id: profile[:_id] })
95
95
  u = User.where( email: profile[:email] ).first
96
- if u
97
- u.profile = p
98
- else
99
- u = User.new( email: profile[:email], password: rand.to_s, profile: p )
100
- end
96
+ u ||= User.new( email: profile[:email], password: rand.to_s )
101
97
  flag = u.save && p.save
102
98
  if flag
103
99
  errors.push({ message: "Profile created for #{profile[:email]}." })
@@ -182,16 +178,21 @@ class IshManager::MapsController < IshManager::ApplicationController
182
178
  end
183
179
  end
184
180
 
181
+ if map_params[:parent_slug].present?
182
+ @map.parent = ::Gameui::Map.find_by({ slug: map_params[:parent_slug] })
183
+ else
184
+ @map.parent = nil
185
+ end
186
+
185
187
  respond_to do |format|
186
- if map_params[:parent_slug].present?
187
- @map.parent = ::Gameui::Map.find_by({ slug: map_params[:parent_slug] })
188
- else
189
- @map.parent = nil
190
- end
191
188
  if @map.update(map_params)
192
- format.html { redirect_to map_path(@map), notice: 'Map was successfully updated.' }
189
+ format.html do # format is required
190
+ redirect_to edit_map_path(@map), notice: 'Map was successfully updated.'
191
+ end
193
192
  else
194
- format.html { render :edit }
193
+ format.html do
194
+ render :edit
195
+ end
195
196
  end
196
197
  end
197
198
  end
@@ -21,7 +21,7 @@ class IshManager::MarkersController < IshManager::ApplicationController
21
21
  @marker.map = @map
22
22
  authorize! :create_marker, @map
23
23
  @map_id = @map.id
24
- @marker.creator_profile_id = current_user.profile.id
24
+ @marker.creator_profile_id = @current_profile.id
25
25
 
26
26
  if params[:image]
27
27
  @marker.image = ::Ish::ImageAsset.new :image => params[:image]
@@ -5,12 +5,6 @@ class IshManager::NewsitemsController < IshManager::ApplicationController
5
5
 
6
6
  def create
7
7
  @newsitem = Newsitem.new params[:newsitem].permit!
8
- @resource ||= City.find params[:city_id] if params[:city_id]
9
- @resource ||= City.find params[:newsitem][:city_id] if !params[:newsitem][:city_id].blank? # blank? required
10
- @resource ||= Site.find params[:site_id] if params[:site_id]
11
- @resource ||= Site.find params[:newsitem][:site_id] if !params[:newsitem][:site_id].blank?
12
- @resource ||= Tag.find params[:tag_id] if params[:tag_id]
13
- @resource ||= Tag.find params[:newsitem][:tag_id] if !params[:newsitem][:tag_id].blank?
14
8
  @resource ||= Ish::UserProfile.find params[:newsitem][:user_profile_id] if !params[:newsitem][:user_profile_id].blank?
15
9
  @resource ||= ::Gameui::Map.find params[:newsitem][:map_id] if !params[:newsitem][:map_id].blank?
16
10
  @resource.newsitems << @newsitem
@@ -20,22 +14,15 @@ class IshManager::NewsitemsController < IshManager::ApplicationController
20
14
 
21
15
  if params[:photo]
22
16
  photo = Photo.create( :photo => params[:photo],
23
- :user_profile => current_user.profile,
17
+ :user_profile => @current_profile,
24
18
  descr: params[:descr],
25
19
  subhead: params[:subhead] )
26
20
  @newsitem.photo = photo
27
21
  end
28
22
 
29
23
  url = case @resource.class.name
30
- when "City"
31
- edit_city_path( @resource.id )
32
24
  when "Ish::UserProfile"
33
25
  user_profiles_path
34
- when "Site"
35
- edit_site_path( @resource.id )
36
- when "Tag"
37
- @resource.site.touch
38
- tag_path( @resource.id )
39
26
  else
40
27
  root_path
41
28
  end
@@ -48,8 +35,6 @@ class IshManager::NewsitemsController < IshManager::ApplicationController
48
35
  else
49
36
  error = 'No Luck. ' + @newsitem.errors.messages.to_s + " :: " + photo.errors.messages.to_s
50
37
  flash[:alert] = error
51
- @sites = Site.list
52
- @cities = City.list
53
38
  render :action => :new
54
39
  end
55
40
  end
@@ -59,9 +44,6 @@ class IshManager::NewsitemsController < IshManager::ApplicationController
59
44
  authorize! :destroy, @newsitem
60
45
 
61
46
  if @newsitem.destroy
62
- Tag.find(@newsitem.tag_id).touch if @newsitem.tag_id
63
- Map.find(@newsitem.map_id).touch if @newsitem.map_id
64
-
65
47
  flash[:notice] = "Destroyed the newsitem."
66
48
  else
67
49
  flash[:alert] = "Cannot destroy the newsitem: #{@newsitem.errors.full_messages}."
@@ -75,35 +57,18 @@ class IshManager::NewsitemsController < IshManager::ApplicationController
75
57
  authorize! :edit, @newsitem
76
58
 
77
59
  ## @TODO: what on earth is this?
78
- out = Gallery.unscoped.where( :is_trash => false, :user_profile => current_user.profile ).order_by( :created_at => :desc )
60
+ out = Gallery.unscoped.where( :is_trash => false, :user_profile => @current_profile ).order_by( :created_at => :desc )
79
61
  @galleries_list = [['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
80
62
 
81
63
  end
82
64
 
83
65
  def index
84
- @resource = Site.find( params[:site_id] ) if params[:site_id]
85
- @resource = City.find( params[:site_id] ) if params[:city_id]
86
-
87
66
  authorize! :newsitems_index, @resource
88
67
  @newsitems = @resource.newsitems
89
68
  end
90
69
 
91
70
  def new
92
-
93
71
  @newsitem = Newsitem.new
94
-
95
- if params[:city_id]
96
- @city = City.find params[:city_id]
97
- @newsitem.city = @city
98
- end
99
- if params[:site_id]
100
- @site = Site.find params[:site_id]
101
- @newsitem.site = @site
102
- end
103
- if params[:tag_id]
104
- @tag = Tag.unscoped.find params[:tag_id]
105
- @newsitem.tag = @tag
106
- end
107
72
  authorize! :new, @newsitem
108
73
  end
109
74
 
@@ -111,17 +76,9 @@ class IshManager::NewsitemsController < IshManager::ApplicationController
111
76
  @newsitem = Newsitem.find params[:id]
112
77
  authorize! :update, @newsitem
113
78
 
114
- ## @TODO: re-add site management here, probably.
115
-
116
- if params[:city_id]
117
- @city = City.find params[:city_id]
118
- @newsitem = @city.newsitems.find params[:id]
119
- url = edit_city_path( @city )
120
- end
121
-
122
79
  if params[:photo]
123
80
  photo = Photo.new :photo => params[:photo]
124
- photo.user_profile = current_user.profile
81
+ photo.user_profile = @current_profile
125
82
  @newsitem.photo = photo
126
83
  end
127
84
 
@@ -132,7 +89,12 @@ class IshManager::NewsitemsController < IshManager::ApplicationController
132
89
  flash[:alert] = "No Luck: #{@newsitem.errors.messages}"
133
90
  end
134
91
 
135
- redirect_to edit_newsitem_path(@newsitem)
92
+ if (@newsitem.map)
93
+ redirect_to map_path(@newsitem.map)
94
+ else
95
+ redirect_to edit_newsitem_path(@newsitem)
96
+ end
97
+
136
98
  end
137
99
 
138
100
  end
@@ -23,7 +23,7 @@ class IshManager::PhotosController < IshManager::ApplicationController
23
23
 
24
24
  def index
25
25
  authorize! :index, Photo
26
- @photos = Photo.all.page( params[:photos_page] )
26
+ @photos = Photo.where( user_profile: @current_profile ).page( params[:photos_page] )
27
27
  end
28
28
 
29
29
  def j_create
@@ -42,8 +42,6 @@ class IshManager::PhotosController < IshManager::ApplicationController
42
42
  @photo.gallery = gallery
43
43
 
44
44
  # cache
45
- @photo.gallery.site.touch if @photo.gallery.site
46
- @photo.gallery.city.touch if @photo.gallery.city
47
45
  @photo.gallery.touch
48
46
 
49
47
  if @photo.save
@@ -7,7 +7,7 @@ class IshManager::ReportsController < IshManager::ApplicationController
7
7
 
8
8
  def create
9
9
  @report = Report.new params[:report].permit!
10
- @report.user_profile = current_user.profile # @TODO: this should not be hard-coded
10
+ @report.user_profile = @current_profile # @TODO: this should not be hard-coded
11
11
  authorize! :create, @report
12
12
 
13
13
  flag = @report.save
@@ -56,7 +56,7 @@ class IshManager::ReportsController < IshManager::ApplicationController
56
56
  def index
57
57
  authorize! :index, Report
58
58
  @reports = Report.unscoped.order_by( :created_at => :desc
59
- ).where( :is_trash => false, :user_profile => current_user.profile
59
+ ).where( :is_trash => false, :user_profile => @current_profile
60
60
  ).page( params[:reports_page] ).per( Report::PER_PAGE )
61
61
  if params[:q]
62
62
  @reports = @reports.or({ slug: /#{params[:q]}/i }, { name: /#{params[:q]}}/i }) # @TODO: why can't I have space in search term?
@@ -4,7 +4,7 @@ class IshManager::UserProfilesController < IshManager::ApplicationController
4
4
  before_action :set_lists
5
5
 
6
6
  def index
7
- @user_profiles = Ish::UserProfile.all.includes( :user )
7
+ @user_profiles = Ish::UserProfile.all
8
8
  authorize! :index, Ish::UserProfile
9
9
  end
10
10
 
@@ -49,21 +49,21 @@ class IshManager::UserProfilesController < IshManager::ApplicationController
49
49
  def create
50
50
  @user = User.find_or_create_by( :email => params[:profile][:email] )
51
51
  @user.password ||= (0...12).map { rand(100) }.join
52
- @user.profile = Ish::UserProfile.new params[:profile].permit!
53
- authorize! :create, @user.profile
52
+ @user_profile = Ish::UserProfile.new params[:profile].permit!
53
+ authorize! :create, @user_profile
54
54
 
55
55
  if params[:photo]
56
56
  photo = Photo.new :photo => params[:photo]
57
- @profile.profile_photo = photo
57
+ @user_profile.profile_photo = photo
58
58
  end
59
59
 
60
60
  if !@user.save
61
- raise "cannot save profile.user: #{@profile.user.errors.full_messages} profile errors: #{@profile.errors.full_messages}"
61
+ raise "cannot save profile.user: #{@user.errors.full_messages} profile errors: #{@user_profile.errors.full_messages}"
62
62
  end
63
- if @user.profile.save
63
+ if @user_profile.save
64
64
  flash[:notice] = "Created profile"
65
65
  else
66
- flash[:alert] = "Cannot create profile: #{@profile.errors.messages}"
66
+ flash[:alert] = "Cannot create profile: #{@user_profile.errors.messages}"
67
67
  end
68
68
  redirect_to :action => :index
69
69
  end
@@ -8,16 +8,7 @@ class IshManager::VideosController < IshManager::ApplicationController
8
8
  def create
9
9
  @video = Video.new params[:video].permit(%i| name descr is_public is_trash is_feature x y lang youtube_id
10
10
  site user_profile premium_tier premium_purchases thumb video |)
11
- @video.user_profile = current_user.profile
12
- if !params[:video][:site_id].blank?
13
- @video.site = Site.find params[:video][:site_id]
14
- @video.site.touch
15
- else
16
- if @site
17
- @video.site = @site
18
- @site.touch
19
- end
20
- end
11
+ @video.user_profile = @current_profile
21
12
  authorize! :create, @video
22
13
 
23
14
  if @video.save
@@ -25,7 +16,6 @@ class IshManager::VideosController < IshManager::ApplicationController
25
16
  redirect_to videos_path
26
17
  else
27
18
  flash[:alert] = 'No luck'
28
- @tags_list = Tag.list
29
19
  render :action => 'new'
30
20
  end
31
21
  end
@@ -34,8 +24,6 @@ class IshManager::VideosController < IshManager::ApplicationController
34
24
  @video = Video.unscoped.find params[:id]
35
25
  authorize! :destroy, @video
36
26
  flag = @video.delete
37
- @video.site.touch if @video.site
38
- @video.tags.map &:touch
39
27
  if flag
40
28
  flash[:notice] = "deleted video"
41
29
  else
@@ -48,23 +36,11 @@ class IshManager::VideosController < IshManager::ApplicationController
48
36
  @video = Video.unscoped.find params[:id]
49
37
  @user_profiles_list = Ish::UserProfile.list
50
38
  authorize! :edit, @video
51
-
52
- @tags_list = Tag.unscoped.or( { :is_public => true }, { :user_id => current_user.id } ).list
53
39
  end
54
40
 
55
41
  def index
56
42
  authorize! :index, Video.new
57
- @videos = Video.unscoped.where( is_trash: false, :user_profile => current_user.profile ).order_by( :created_at => :desc )
58
-
59
- if params[:tag_id]
60
- tag = Tag.find params[:tag_id]
61
- @videos = @videos.where( :tag => tag )
62
- end
63
-
64
- if params[:site_id]
65
- @site = Site.find params[:site_id]
66
- @videos = @site.videos
67
- end
43
+ @videos = Video.unscoped.where( is_trash: false, :user_profile => @current_profile ).order_by( :created_at => :desc )
68
44
 
69
45
  if params[:q]
70
46
  @videos = @videos.where({ :name => /#{params[:q]}/i })
@@ -98,8 +74,6 @@ class IshManager::VideosController < IshManager::ApplicationController
98
74
  def new
99
75
  @video = Video.new
100
76
  authorize! :new, @video
101
-
102
- @tags_list = Tag.unscoped.or( { :is_public => true }, { :user_id => current_user.id } ).list
103
77
  end
104
78
 
105
79
  def update
@@ -108,7 +82,6 @@ class IshManager::VideosController < IshManager::ApplicationController
108
82
 
109
83
  @video.update params[:video].permit!
110
84
  if @video.save
111
- @video.site.touch if @video.site
112
85
  flash[:notice] = 'Success.'
113
86
  redirect_to videos_path
114
87
  else
@@ -8,7 +8,8 @@ module IshManager
8
8
  elsif layout.instance_of? String or layout.instance_of? Symbol
9
9
  layout
10
10
  else
11
- File.basename(layout.identifier).split('.').first
11
+ layout.inspect
12
+ # File.basename(layout.identifier).split('.').first
12
13
  end
13
14
  end
14
15
 
@@ -39,24 +40,9 @@ module IshManager
39
40
  "$ #{'%.2f' % a}"
40
41
  end
41
42
 
42
- def resource_path resource
43
- case resource.class.name
44
- when 'City'
45
- city_path( resource.id )
46
- when 'Event'
47
- event_path( resource.id )
48
- when 'Venue'
49
- venue_path( resource.id )
50
- end
51
- end
52
-
53
43
  #
54
44
  # api paths
55
45
  #
56
- def api_city_path city
57
- "/api/cities/view/#{city.cityname}.json"
58
- end
59
-
60
46
  def api_map_path map
61
47
  "/api/maps/view/#{map.slug}"
62
48
  end
@@ -66,9 +66,9 @@ class IshManager::Ability
66
66
 
67
67
 
68
68
  #
69
- # role guy (and manager)
69
+ # role guy
70
70
  #
71
- if user_profile && [ :manager, :guy ].include?( user_profile.role_name )
71
+ if user_profile && :guy == user_profile.role_name
72
72
 
73
73
  can [ :index, :new, :create ], ::Gallery
74
74
  can [ :show, :edit, :update, :create_photo ], ::Gallery do |gallery|
@@ -78,6 +78,8 @@ class IshManager::Ability
78
78
  gallery.shared_profiles.include? user_profile
79
79
  end
80
80
 
81
+ # can [ :create, :index, :new ], Photo
82
+
81
83
  # can [ :index ], ::Report
82
84
 
83
85
  # can [ :index ], ::Video
@@ -5,9 +5,9 @@
5
5
  %i.fa.fa-compress.collapse-expand#collapseHeaderPiCMS
6
6
  PiousboxCMS
7
7
  %ul
8
- %li
9
- = link_to 'Photos', photos_path
10
- = link_to '[+]', new_photo_path
8
+ -# %li
9
+ -# = link_to 'Photos', photos_path
10
+ -# = link_to '[+]', new_photo_path
11
11
  %li
12
12
  = render 'ish_manager/galleries/menu'
13
13
  %li
@@ -0,0 +1,4 @@
1
+
2
+ -# Used only in email_contexts#index right now. _vp_ 2022-10-06
3
+
4
+ = paginate resource, param_name: resource.klass::PAGE_PARAM_NAME, views_prefix: 'ish_manager'