File tree Expand file tree Collapse file tree 6 files changed +44
-4
lines changed
Expand file tree Collapse file tree 6 files changed +44
-4
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ class DocumentsController < ApplicationController
1212 before_action :set_navbar_actions , except : [ :edit , :plaintext ]
1313 before_action :set_footer_visibility , only : [ :edit ]
1414
15+ # Skip UI-heavy calls for API endpoints
16+ skip_before_action :cache_most_used_page_information , only : [ :update ]
17+ skip_before_action :cache_forums_unread_counts , only : [ :update ]
18+
1519 # TODO: verify_user_can_read, verify_user_can_edit, etc before_actions instead of inlining them
1620
1721 before_action :cache_linkable_content_for_each_content_type , only : [ :edit ]
Original file line number Diff line number Diff line change @@ -17,7 +17,14 @@ def private_image_uploads
1717 end
1818
1919 def random_image_including_private ( format : :medium )
20- image_uploads . sample . try ( :src , format ) . presence || "card-headers/#{ self . class . name . downcase . pluralize } .jpg"
20+ @random_image_including_private_cache ||= { }
21+ key = self . class . name + self . id . to_s
22+ return @random_image_including_private_cache [ key ] if @random_image_including_private_cache . key? ( key )
23+
24+ result = image_uploads . sample . try ( :src , format ) . presence || "card-headers/#{ self . class . name . downcase . pluralize } .jpg"
25+ @random_image_including_private_cache [ key ] = result
26+
27+ result
2128 end
2229
2330 def first_public_image ( format : :medium )
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class Creature < ApplicationRecord
2020 include Serendipitous ::Concern
2121
2222 include Authority ::Abilities
23- self . authorizer_name = 'ExtendedContentAuthorizer '
23+ self . authorizer_name = 'CoreContentAuthorizer '
2424
2525 # Locations
2626 relates :habitats , with : :wildlifeships
Original file line number Diff line number Diff line change 186186 <% end %>
187187
188188 < div class ="grey-text uppercase center "> Create something new</ div >
189+ <% shown_creatures = false %>
189190 <% @activated_content_types . sample ( 3 ) . each do |type | %>
190191 <% klass = content_class_from_name ( type ) %>
192+ <% shown_creatures = true if type == 'Creature' %>
191193 < div >
192194 <%= link_to send ( "new_#{ type . downcase } _path" ) , class : "white-text" , style : 'width: 100%' do %>
193195 < div class ="hoverable card-panel <%= klass . color %> " style ="margin-bottom: 4px ">
209211 <% end %>
210212 </ div >
211213 <% end %>
214+
215+ < br />
216+ < div >
217+ <%= link_to new_creature_path , class : "white-text" , style : 'width: 100%' do %>
218+ < div class ="hoverable card-panel <%= Creature . color %> " style ="margin-bottom: 4px ">
219+ < div class ="valign-wrapper ">
220+ < i class ="material-icons grey-bordered-text " class ="left " style ="font-size: 3em; "> <%= Creature . icon %> </ i >
221+ < span style ="font-size: 1.1em; margin-left: 1em ">
222+ New Creature< br />
223+ < small >
224+ Free for all users in October
225+ </ small >
226+ </ span >
227+ </ div >
228+ </ div >
229+ <% end %>
230+ </ div >
231+
212232 </ div >
213233</ div >
214234
Original file line number Diff line number Diff line change 6666
6767 # Content types to label as "new" around the site
6868 new : [
69- Lore
69+
7070 ]
7171}
7272
Original file line number Diff line number Diff line change 66Rails . application . config . promos [ :promo_bogo ] [ :start_date ] = 'March 21, 2020' . to_date
77Rails . application . config . promos [ :promo_bogo ] [ :end_date ] = Rails . application . config . promos [ :promo_bogo ] [ :start_date ] + 2 . weeks
88
9- # Lore free during the month of April
9+ # Lore free during the month of April, 2020
1010# Need to change Lore.rb authorizer at the end lol
1111if Date . current >= 'March 1, 2020' . to_date
1212 if Date . current < 'April 1, 2020' . to_date
1313 Rails . application . config . content_types [ :free ] << Lore
1414 Rails . application . config . content_types [ :premium ] -= [ Lore ]
1515 end
1616end
17+
18+ # Lore free during the month of October
19+ # Need to change Creature.rb authorizer at the end
20+ if Date . current >= 'October 1, 2021' . to_date
21+ if Date . current < 'November 1, 2021' . to_date
22+ Rails . application . config . content_types [ :free ] << Creature
23+ Rails . application . config . content_types [ :premium ] -= [ Creature ]
24+ end
25+ end
You can’t perform that action at this time.
0 commit comments