koalagator 4.1.0 → 5.0.0

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 (134) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +661 -0
  3. data/README.md +74 -21
  4. data/app/assets/config/calagator/manifest.js +5 -1
  5. data/app/assets/images/external_sites/mastodon.png +0 -0
  6. data/app/assets/images/nav_marker.png +0 -0
  7. data/app/assets/javascripts/calagator/forms.js +7 -0
  8. data/app/assets/stylesheets/calagator/custom/calendar.css +137 -0
  9. data/app/assets/stylesheets/calagator/errors.css +2 -4
  10. data/app/assets/stylesheets/calagator/forms.scss +5 -0
  11. data/app/assets/stylesheets/calagator/layout.scss +31 -9
  12. data/app/assets/stylesheets/calagator/typography.scss +39 -9
  13. data/app/assets/stylesheets/calagator/utils.scss +44 -0
  14. data/app/controllers/calagator/admin/curations_controller.rb +62 -0
  15. data/app/controllers/calagator/admin/users_controller.rb +79 -0
  16. data/app/controllers/calagator/application_controller.rb +29 -5
  17. data/app/controllers/calagator/curations_controller.rb +32 -0
  18. data/app/controllers/calagator/events_controller.rb +6 -0
  19. data/app/controllers/calagator/paper_trail_manager_controller.rb +5 -0
  20. data/app/controllers/calagator/passwords_controller.rb +4 -0
  21. data/app/controllers/calagator/registrations_controller.rb +5 -0
  22. data/app/controllers/calagator/sessions_controller.rb +4 -0
  23. data/app/controllers/calagator/site_controller.rb +10 -0
  24. data/app/controllers/calagator/sources_controller.rb +2 -0
  25. data/app/controllers/calagator/venues_controller.rb +5 -1
  26. data/app/controllers/calagator/versions_controller.rb +1 -1
  27. data/app/controllers/paper_trail_manager/changes_controller.rb +16 -16
  28. data/app/helpers/calagator/application_helper.rb +32 -3
  29. data/app/helpers/calagator/time_range_helper.rb +1 -1
  30. data/app/helpers/paper_trail_manager/changes_helper.rb +7 -7
  31. data/app/javascript/calagator/calendar/calendar.js +82 -0
  32. data/app/javascript/calagator/calendar/event.js +94 -0
  33. data/app/javascript/calagator/calendar/lib/components.js +120 -0
  34. data/app/javascript/calagator/calendar/lib/utils.js +67 -0
  35. data/app/models/calagator/curation.rb +32 -0
  36. data/app/models/calagator/event/browse.rb +3 -2
  37. data/app/models/calagator/event/cloner.rb +1 -1
  38. data/app/models/calagator/event/ical_renderer.rb +1 -1
  39. data/app/models/calagator/event/overview.rb +3 -1
  40. data/app/models/calagator/event/saver.rb +6 -1
  41. data/app/models/calagator/event/search.rb +1 -1
  42. data/app/models/calagator/event/search_engine.rb +1 -1
  43. data/app/models/calagator/event.rb +22 -5
  44. data/app/models/calagator/source/parser/hcal.rb +1 -1
  45. data/app/models/calagator/source/parser.rb +3 -3
  46. data/app/models/calagator/source.rb +23 -6
  47. data/app/models/calagator/user.rb +50 -0
  48. data/app/models/calagator/venue/geocoder.rb +1 -1
  49. data/app/models/calagator/venue/search.rb +1 -1
  50. data/app/models/calagator/venue/search_engine.rb +1 -1
  51. data/app/models/calagator/venue.rb +20 -1
  52. data/app/models/concerns/calagator/event_filterable.rb +22 -0
  53. data/app/views/calagator/admin/curations/_form.html.erb +56 -0
  54. data/app/views/calagator/admin/curations/_index.html.erb +12 -0
  55. data/app/views/calagator/admin/curations/edit.html.erb +2 -0
  56. data/app/views/calagator/admin/curations/index.html.erb +21 -0
  57. data/app/views/calagator/admin/curations/new.html.erb +2 -0
  58. data/app/views/calagator/admin/index.html.erb +6 -2
  59. data/app/views/calagator/admin/users/_form.html.erb +28 -0
  60. data/app/views/calagator/admin/users/edit.html.erb +7 -0
  61. data/app/views/calagator/admin/users/index.html.erb +38 -0
  62. data/app/views/calagator/admin/users/invite.html.erb +19 -0
  63. data/app/views/calagator/admin/users/new.html.erb +3 -0
  64. data/app/views/calagator/curations/show.html.erb +17 -0
  65. data/app/views/calagator/events/_index.html.erb +59 -0
  66. data/app/views/calagator/events/_item.html.erb +10 -3
  67. data/app/views/calagator/events/_subnav.html.erb +7 -2
  68. data/app/views/calagator/events/_subnav_custom.html.erb +0 -0
  69. data/app/views/calagator/events/index.atom.builder +1 -1
  70. data/app/views/calagator/events/index.html.erb +9 -60
  71. data/app/views/calagator/events/show.html.erb +5 -3
  72. data/app/views/calagator/shared/_calendar.html.erb +7 -0
  73. data/app/views/calagator/shared/_subnav_curations.html.erb +5 -0
  74. data/app/views/calagator/shared/_subnav_pinned_venues.html.erb +5 -0
  75. data/app/views/calagator/site/_contact.html.erb +1 -0
  76. data/app/views/calagator/site/_description.html.erb +2 -2
  77. data/app/views/calagator/site/about.html.erb +9 -0
  78. data/app/views/calagator/site/closed_registrations.html.erb +2 -0
  79. data/app/views/calagator/site/embed.html.erb +16 -0
  80. data/app/views/calagator/site/index.html.erb +1 -1
  81. data/app/views/calagator/sources/index.html.erb +1 -1
  82. data/app/views/calagator/sources/show.html.erb +1 -1
  83. data/app/views/calagator/venues/_form.html.erb +5 -1
  84. data/app/views/calagator/venues/_subnav.html.erb +9 -1
  85. data/app/views/calagator/venues/_subnav_custom.html.erb +0 -0
  86. data/app/views/calagator/venues/show.html.erb +1 -1
  87. data/app/views/layouts/calagator/_devise.html.erb +17 -0
  88. data/app/views/layouts/calagator/_footer.html.erb +3 -1
  89. data/app/views/layouts/calagator/_head.html.erb +0 -0
  90. data/app/views/layouts/calagator/_header.html.erb +3 -0
  91. data/app/views/layouts/calagator/application.html.erb +3 -0
  92. data/app/views/layouts/calagator/embed.html.erb +15 -0
  93. data/app/views/paper_trail_manager/changes/_version.html.erb +5 -5
  94. data/app/views/paper_trail_manager/changes/index.atom.builder +12 -12
  95. data/bin/{calagator → koalagator} +12 -14
  96. data/config/importmap.rb +11 -0
  97. data/config/initializers/admin_user.rb +15 -0
  98. data/config/initializers/observers.rb +1 -1
  99. data/config/initializers/paper_trail_manager.rb +1 -1
  100. data/config/locales/devise.en.yml +65 -0
  101. data/config/routes.rb +26 -1
  102. data/db/migrate/20240319042449_devise_create_calagator_users.rb +43 -0
  103. data/db/migrate/20240319061154_add_admin_flag_to_calagator_user.rb +5 -0
  104. data/db/migrate/20240320043535_add_name_to_calagator_user.rb +8 -0
  105. data/db/migrate/20240322035554_add_created_by_to_records.rb +12 -0
  106. data/db/migrate/20240510051940_create_calagator_curations.rb +15 -0
  107. data/db/migrate/20240628055300_add_pinned_to_venue.rb +5 -0
  108. data/db/seeds.rb +49 -0
  109. data/lib/calagator/decode_html_entities_hack.rb +1 -1
  110. data/lib/calagator/engine.rb +16 -1
  111. data/lib/calagator/machine_tag.rb +1 -1
  112. data/lib/calagator/strip_whitespace.rb +1 -1
  113. data/lib/calagator/vcalendar.rb +4 -4
  114. data/lib/calagator/version.rb +4 -1
  115. data/lib/generators/calagator/install_generator.rb +9 -1
  116. data/lib/generators/calagator/templates/app/views/devise/registrations/edit.html.erb +48 -0
  117. data/lib/generators/calagator/templates/app/views/devise/registrations/new.html.erb +29 -0
  118. data/lib/generators/calagator/templates/config/initializers/01_calagator.rb +34 -6
  119. data/lib/generators/calagator/templates/config/initializers/04_devise.rb +314 -0
  120. data/lib/{calagator.rb → koalagator.rb} +15 -3
  121. data/lib/paper_trail_manager.rb +11 -11
  122. data/lib/theme_reader.rb +1 -1
  123. data/rails_template.rb +6 -6
  124. data/vendor/javascript/@event-calendar--core.js +10 -0
  125. data/vendor/javascript/@event-calendar--day-grid.js +2 -0
  126. data/vendor/javascript/@event-calendar--list.js +2 -0
  127. data/vendor/javascript/ical.js.js +2 -0
  128. metadata +145 -92
  129. data/MIT-LICENSE.txt +0 -23
  130. data/app/models/calagator/event/search_engine/apache_sunspot.rb +0 -106
  131. data/app/models/calagator/venue/search_engine/apache_sunspot.rb +0 -85
  132. data/lib/tasks/sunspot_reindex_calagator.rake +0 -20
  133. data/lib/tasks/sunspot_solr_restart_enhancements.rake +0 -20
  134. data/lib/wait_for_solr.rb +0 -26
@@ -0,0 +1,48 @@
1
+ <h2>Edit <%= resource_name.to_s.humanize %></h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
4
+ <%= render "devise/shared/error_messages", resource: resource %>
5
+
6
+ <div class="field">
7
+ <%= f.label :name %><br />
8
+ <%= f.text_field :name, autofocus: true, autocomplete: "username", oninput: "formatNameField(event)", pattern: "[a-z0-9_\-]+" %>
9
+ </div>
10
+
11
+ <div class="field">
12
+ <%= f.label :email %><br />
13
+ <%= f.email_field :email, autocomplete: "email" %>
14
+ </div>
15
+
16
+ <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
17
+ <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
18
+ <% end %>
19
+
20
+ <div class="field">
21
+ <%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
22
+ <%= f.password_field :password, autocomplete: "new-password" %>
23
+ <% if @minimum_password_length %>
24
+ <br />
25
+ <em><%= @minimum_password_length %> characters minimum</em>
26
+ <% end %>
27
+ </div>
28
+
29
+ <div class="field">
30
+ <%= f.label :password_confirmation %><br />
31
+ <%= f.password_field :password_confirmation, autocomplete: "new-password" %>
32
+ </div>
33
+
34
+ <div class="field">
35
+ <%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
36
+ <%= f.password_field :current_password, autocomplete: "current-password" %>
37
+ </div>
38
+
39
+ <div class="actions">
40
+ <%= f.submit "Update" %>
41
+ </div>
42
+ <% end %>
43
+
44
+ <h3>Cancel my account</h3>
45
+
46
+ <div>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?" }, method: :delete %></div>
47
+
48
+ <%= link_to "Back", :back %>
@@ -0,0 +1,29 @@
1
+ <h2>Sign up</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
4
+ <%= render "devise/shared/error_messages", resource: resource %>
5
+
6
+ <div class="field">
7
+ <%= f.label :name %><br />
8
+ <%= f.text_field :name, autofocus: true, autocomplete: "username", oninput: "formatNameField(event)", pattern: "[a-z0-9_\-]+" %>
9
+ </div>
10
+
11
+ <div class="field">
12
+ <%= f.label :email %><br />
13
+ <%= f.email_field :email, autocomplete: "email" %>
14
+ </div>
15
+
16
+ <div class="field">
17
+ <%= f.label :password %>
18
+ <% if @minimum_password_length %>
19
+ <em>(<%= @minimum_password_length %> characters minimum)</em>
20
+ <% end %><br />
21
+ <%= f.password_field :password, autocomplete: "new-password" %>
22
+ </div>
23
+
24
+ <div class="actions">
25
+ <%= f.submit "Sign up" %>
26
+ </div>
27
+ <% end %>
28
+
29
+ <%= render "devise/shared/links" %>
@@ -2,26 +2,54 @@
2
2
 
3
3
  Calagator.setup do |config|
4
4
  # Site name
5
- config.title = "Calagator"
5
+ config.title = "Koalagator"
6
6
 
7
7
  # Site tagline
8
8
  config.tagline = "A Tech Calendar"
9
9
 
10
10
  # Site URL with trailing slash
11
- config.url = "http://my-calagator.org/"
11
+ config.url = "http://my-koalagator.org/"
12
12
 
13
13
  # Email address of administrator that will get exception notifications
14
14
  # and requests for assistance from users:
15
15
  config.administrator_email = "your@email.addr"
16
16
 
17
+ # Enable devise based authentication
18
+ # Calagator won't load any devise config unless it's enabled,
19
+ # allowing you to roll your own authentication instead, if desired.
20
+ # When enabled, users will need to sign up, and be signed in
21
+ # to create / modify events.
22
+ # Also configure 'admin_email', 'admin_username', and 'admin_password' for Calagator
23
+ # to create the initial admin user.
24
+ # config.devise_enabled = true
25
+
26
+ # If devise is enabled, the following will configure authorization
27
+ # to CRUD various resources.
28
+ # Valid resources are: changes, events, venues
29
+ # NOTE: Venues can still be created by events, so it's probably best to put them in same category as events.
30
+ #
31
+ # Resources in this category can only be CRUDed by admin users.
32
+ config.admin_resources = %i[changes]
33
+ # Resources in this category can be CRUDed by any authenticated user.
34
+ config.user_resources = %i[events venues]
35
+
17
36
  # Optional username and password to use when accessing /admin pages
37
+ # config.admin_email = 'admin@e.com'
18
38
  # config.admin_username = 'admin'
19
- # config.admin_password = ENV['CALAGATOR_ADMIN_PASSWORD']
39
+ # config.admin_password = ENV['KOALAGATOR_ADMIN_PASSWORD']
40
+
41
+ # Emoji used as administrator icon
42
+ config.admin_icon = "🐨"
43
+
44
+ # Configure open registration, if devise is enabled
45
+ config.open_registration = true
20
46
 
21
47
  # Search engine to use for searching events.
22
- # Values: :sql, :sunspot.
23
48
  config.search_engine = :sql
24
49
 
50
+ # Enable caching of views (not recommended for sites with little activity)
51
+ config.cache_enabled = true
52
+
25
53
  # Set the iCalendar SEQUENCE, which should be increased each time an event
26
54
  # is updated. If an admin needs to forcefully increment the SEQUENCE for all
27
55
  # events, they can set this icalendar_sequence_offset value to something
@@ -43,10 +71,10 @@ Calagator.setup do |config|
43
71
 
44
72
  # The tile provider to use when rendering maps with Leaflet.
45
73
  # One of: leaflet, stamen, mapbox, google
46
- config.mapping_provider = "stamen"
74
+ config.mapping_provider = "leaflet"
47
75
 
48
76
  # The tiles to use for the map, see the docs for individual Leaflet plugins.
49
- config.mapping_tiles = "terrain"
77
+ config.mapping_tiles = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
50
78
 
51
79
  # Other mapping examples:
52
80
  #
@@ -0,0 +1,314 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Assuming you have not yet modified this file, each configuration option below
4
+ # is set to its default value. Note that some are commented out while others
5
+ # are not: uncommented lines are intended to protect your configuration from
6
+ # breaking changes in upgrades (i.e., in the event that future versions of
7
+ # Devise change the default values for those options).
8
+ #
9
+ # Use this hook to configure devise mailer, warden hooks and so forth.
10
+ # Many of these configuration options can be set straight in your model.
11
+ Devise.setup do |config|
12
+ break unless Calagator.devise_enabled
13
+ # The secret key used by Devise. Devise uses this key to generate
14
+ # random tokens. Changing this key will render invalid all existing
15
+ # confirmation, reset password and unlock tokens in the database.
16
+ # Devise will use the `secret_key_base` as its `secret_key`
17
+ # by default. You can change it below and use your own secret key.
18
+ # config.secret_key = '29d17e0144bcf24c83819e3ab3694d2bca904d86929e83a3363570b00cb271fb6e88b3d548fd8d6a1c7494b8d3bb49c228229b0c4ef0a164ba3f86fc6b639922'
19
+
20
+ # ==> Controller configuration
21
+ # Configure the parent class to the devise controllers.
22
+ config.parent_controller = "Calagator::ApplicationController"
23
+
24
+ # ==> Mailer Configuration
25
+ # Configure the e-mail address which will be shown in Devise::Mailer,
26
+ # note that it will be overwritten if you use your own mailer class
27
+ # with default "from" parameter.
28
+ config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
29
+
30
+ # Configure the class responsible to send e-mails.
31
+ # config.mailer = 'Devise::Mailer'
32
+
33
+ # Configure the parent class responsible to send e-mails.
34
+ # config.parent_mailer = 'ActionMailer::Base'
35
+
36
+ # ==> ORM configuration
37
+ # Load and configure the ORM. Supports :active_record (default) and
38
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
39
+ # available as additional gems.
40
+ require "devise/orm/active_record"
41
+
42
+ # ==> Configuration for any authentication mechanism
43
+ # Configure which keys are used when authenticating a user. The default is
44
+ # just :email. You can configure it to use [:username, :subdomain], so for
45
+ # authenticating a user, both parameters are required. Remember that those
46
+ # parameters are used only when authenticating and not when retrieving from
47
+ # session. If you need permissions, you should implement that in a before filter.
48
+ # You can also supply a hash where the value is a boolean determining whether
49
+ # or not authentication should be aborted when the value is not present.
50
+ # config.authentication_keys = [:email]
51
+
52
+ # Configure parameters from the request object used for authentication. Each entry
53
+ # given should be a request method and it will automatically be passed to the
54
+ # find_for_authentication method and considered in your model lookup. For instance,
55
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
56
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
57
+ # config.request_keys = []
58
+
59
+ # Configure which authentication keys should be case-insensitive.
60
+ # These keys will be downcased upon creating or modifying a user and when used
61
+ # to authenticate or find a user. Default is :email.
62
+ config.case_insensitive_keys = [:email]
63
+
64
+ # Configure which authentication keys should have whitespace stripped.
65
+ # These keys will have whitespace before and after removed upon creating or
66
+ # modifying a user and when used to authenticate or find a user. Default is :email.
67
+ config.strip_whitespace_keys = [:email]
68
+
69
+ # Tell if authentication through request.params is enabled. True by default.
70
+ # It can be set to an array that will enable params authentication only for the
71
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
72
+ # enable it only for database (email + password) authentication.
73
+ # config.params_authenticatable = true
74
+
75
+ # Tell if authentication through HTTP Auth is enabled. False by default.
76
+ # It can be set to an array that will enable http authentication only for the
77
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
78
+ # enable it only for database authentication.
79
+ # For API-only applications to support authentication "out-of-the-box", you will likely want to
80
+ # enable this with :database unless you are using a custom strategy.
81
+ # The supported strategies are:
82
+ # :database = Support basic authentication with authentication key + password
83
+ # config.http_authenticatable = false
84
+
85
+ # If 401 status code should be returned for AJAX requests. True by default.
86
+ # config.http_authenticatable_on_xhr = true
87
+
88
+ # The realm used in Http Basic Authentication. 'Application' by default.
89
+ # config.http_authentication_realm = 'Application'
90
+
91
+ # It will change confirmation, password recovery and other workflows
92
+ # to behave the same regardless if the e-mail provided was right or wrong.
93
+ # Does not affect registerable.
94
+ # config.paranoid = true
95
+
96
+ # By default Devise will store the user in session. You can skip storage for
97
+ # particular strategies by setting this option.
98
+ # Notice that if you are skipping storage for all authentication paths, you
99
+ # may want to disable generating routes to Devise's sessions controller by
100
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
101
+ config.skip_session_storage = [:http_auth]
102
+
103
+ # By default, Devise cleans up the CSRF token on authentication to
104
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
105
+ # requests for sign in and sign up, you need to get a new CSRF token
106
+ # from the server. You can disable this option at your own risk.
107
+ # config.clean_up_csrf_token_on_authentication = true
108
+
109
+ # When false, Devise will not attempt to reload routes on eager load.
110
+ # This can reduce the time taken to boot the app but if your application
111
+ # requires the Devise mappings to be loaded during boot time the application
112
+ # won't boot properly.
113
+ # config.reload_routes = true
114
+
115
+ # ==> Configuration for :database_authenticatable
116
+ # For bcrypt, this is the cost for hashing the password and defaults to 12. If
117
+ # using other algorithms, it sets how many times you want the password to be hashed.
118
+ # The number of stretches used for generating the hashed password are stored
119
+ # with the hashed password. This allows you to change the stretches without
120
+ # invalidating existing passwords.
121
+ #
122
+ # Limiting the stretches to just one in testing will increase the performance of
123
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
124
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
125
+ # algorithm), the cost increases exponentially with the number of stretches (e.g.
126
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
127
+ config.stretches = Rails.env.test? ? 1 : 12
128
+
129
+ # Set up a pepper to generate the hashed password.
130
+ # config.pepper = '7c60d51f925510234425ffd3e9a0425cc59da9c16cf12ef282bde4c38c46d6ce8926df2ead4ddbba01efab69199a8848addbe42453ce41c5f645315730f41a8c'
131
+
132
+ # Send a notification to the original email when the user's email is changed.
133
+ # config.send_email_changed_notification = false
134
+
135
+ # Send a notification email when the user's password is changed.
136
+ # config.send_password_change_notification = false
137
+
138
+ # ==> Configuration for :confirmable
139
+ # A period that the user is allowed to access the website even without
140
+ # confirming their account. For instance, if set to 2.days, the user will be
141
+ # able to access the website for two days without confirming their account,
142
+ # access will be blocked just in the third day.
143
+ # You can also set it to nil, which will allow the user to access the website
144
+ # without confirming their account.
145
+ # Default is 0.days, meaning the user cannot access the website without
146
+ # confirming their account.
147
+ # config.allow_unconfirmed_access_for = 2.days
148
+
149
+ # A period that the user is allowed to confirm their account before their
150
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
151
+ # their account within 3 days after the mail was sent, but on the fourth day
152
+ # their account can't be confirmed with the token any more.
153
+ # Default is nil, meaning there is no restriction on how long a user can take
154
+ # before confirming their account.
155
+ # config.confirm_within = 3.days
156
+
157
+ # If true, requires any email changes to be confirmed (exactly the same way as
158
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
159
+ # db field (see migrations). Until confirmed, new email is stored in
160
+ # unconfirmed_email column, and copied to email column on successful confirmation.
161
+ config.reconfirmable = true
162
+
163
+ # Defines which key will be used when confirming an account
164
+ # config.confirmation_keys = [:email]
165
+
166
+ # ==> Configuration for :rememberable
167
+ # The time the user will be remembered without asking for credentials again.
168
+ # config.remember_for = 2.weeks
169
+
170
+ # Invalidates all the remember me tokens when the user signs out.
171
+ config.expire_all_remember_me_on_sign_out = true
172
+
173
+ # If true, extends the user's remember period when remembered via cookie.
174
+ # config.extend_remember_period = false
175
+
176
+ # Options to be passed to the created cookie. For instance, you can set
177
+ # secure: true in order to force SSL only cookies.
178
+ # config.rememberable_options = {}
179
+
180
+ # ==> Configuration for :validatable
181
+ # Range for password length.
182
+ config.password_length = 6..128
183
+
184
+ # Email regex used to validate email formats. It simply asserts that
185
+ # one (and only one) @ exists in the given string. This is mainly
186
+ # to give user feedback and not to assert the e-mail validity.
187
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
188
+
189
+ # ==> Configuration for :timeoutable
190
+ # The time you want to timeout the user session without activity. After this
191
+ # time the user will be asked for credentials again. Default is 30 minutes.
192
+ # config.timeout_in = 30.minutes
193
+
194
+ # ==> Configuration for :lockable
195
+ # Defines which strategy will be used to lock an account.
196
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
197
+ # :none = No lock strategy. You should handle locking by yourself.
198
+ # config.lock_strategy = :failed_attempts
199
+
200
+ # Defines which key will be used when locking and unlocking an account
201
+ # config.unlock_keys = [:email]
202
+
203
+ # Defines which strategy will be used to unlock an account.
204
+ # :email = Sends an unlock link to the user email
205
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
206
+ # :both = Enables both strategies
207
+ # :none = No unlock strategy. You should handle unlocking by yourself.
208
+ # config.unlock_strategy = :both
209
+
210
+ # Number of authentication tries before locking an account if lock_strategy
211
+ # is failed attempts.
212
+ # config.maximum_attempts = 20
213
+
214
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
215
+ # config.unlock_in = 1.hour
216
+
217
+ # Warn on the last attempt before the account is locked.
218
+ # config.last_attempt_warning = true
219
+
220
+ # ==> Configuration for :recoverable
221
+ #
222
+ # Defines which key will be used when recovering the password for an account
223
+ # config.reset_password_keys = [:email]
224
+
225
+ # Time interval you can reset your password with a reset password key.
226
+ # Don't put a too small interval or your users won't have the time to
227
+ # change their passwords.
228
+ config.reset_password_within = 6.hours
229
+
230
+ # When set to false, does not sign a user in automatically after their password is
231
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
232
+ # config.sign_in_after_reset_password = true
233
+
234
+ # ==> Configuration for :encryptable
235
+ # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
236
+ # You can use :sha1, :sha512 or algorithms from others authentication tools as
237
+ # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
238
+ # for default behavior) and :restful_authentication_sha1 (then you should set
239
+ # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
240
+ #
241
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
242
+ # config.encryptor = :sha512
243
+
244
+ # ==> Scopes configuration
245
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
246
+ # "users/sessions/new". It's turned off by default because it's slower if you
247
+ # are using only default views.
248
+ # config.scoped_views = false
249
+
250
+ # Configure the default scope given to Warden. By default it's the first
251
+ # devise role declared in your routes (usually :user).
252
+ # config.default_scope = :user
253
+
254
+ # Set this configuration to false if you want /users/sign_out to sign out
255
+ # only the current scope. By default, Devise signs out all scopes.
256
+ # config.sign_out_all_scopes = true
257
+
258
+ # ==> Navigation configuration
259
+ # Lists the formats that should be treated as navigational. Formats like
260
+ # :html should redirect to the sign in page when the user does not have
261
+ # access, but formats like :xml or :json, should return 401.
262
+ #
263
+ # If you have any extra navigational formats, like :iphone or :mobile, you
264
+ # should add them to the navigational formats lists.
265
+ #
266
+ # The "*/*" below is required to match Internet Explorer requests.
267
+ # config.navigational_formats = ['*/*', :html, :turbo_stream]
268
+
269
+ # The default HTTP method used to sign out a resource. Default is :delete.
270
+ config.sign_out_via = :delete
271
+
272
+ # ==> OmniAuth
273
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
274
+ # up on your models and hooks.
275
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
276
+
277
+ # ==> Warden configuration
278
+ # If you want to use other strategies, that are not supported by Devise, or
279
+ # change the failure app, you can configure them inside the config.warden block.
280
+ #
281
+ # config.warden do |manager|
282
+ # manager.intercept_401 = false
283
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
284
+ # end
285
+
286
+ # ==> Mountable engine configurations
287
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
288
+ # is mountable, there are some extra configurations to be taken into account.
289
+ # The following options are available, assuming the engine is mounted as:
290
+ #
291
+ # mount MyEngine, at: '/my_engine'
292
+ #
293
+ # The router that invoked `devise_for`, in the example above, would be:
294
+ config.router_name = :calagator
295
+ #
296
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
297
+ # so you need to do it manually. For the users scope, it would be:
298
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
299
+
300
+ # ==> Hotwire/Turbo configuration
301
+ # When using Devise with Hotwire/Turbo, the http status for error responses
302
+ # and some redirects must match the following. The default in Devise for existing
303
+ # apps is `200 OK` and `302 Found` respectively, but new apps are generated with
304
+ # these new defaults that match Hotwire/Turbo behavior.
305
+ # Note: These might become the new default in future versions of Devise.
306
+ config.responder.error_status = :unprocessable_entity
307
+ config.responder.redirect_status = :see_other
308
+
309
+ # ==> Configuration for :registerable
310
+
311
+ # When set to false, does not sign a user in automatically after their password is
312
+ # changed. Defaults to true, so a user is signed in automatically after changing a password.
313
+ # config.sign_in_after_change_password = true
314
+ end
@@ -23,17 +23,22 @@ require "jquery-ui-rails"
23
23
  require "font-awesome-rails"
24
24
  require "paper_trail_manager"
25
25
  require "utf8-cleaner"
26
- require "sunspot_rails"
27
26
  require "lucene_query"
28
27
  require "rack/contrib/jsonp"
28
+ require "devise"
29
29
 
30
30
  module Calagator
31
31
  mattr_accessor :title,
32
32
  :tagline,
33
33
  :url,
34
34
  :administrator_email,
35
+ :admin_email,
35
36
  :admin_username,
36
37
  :admin_password,
38
+ :admin_icon,
39
+ :admin_resources,
40
+ :open_registration,
41
+ :user_resources,
37
42
  :search_engine,
38
43
  :icalendar_sequence_offset,
39
44
  :mapping_marker_color,
@@ -41,12 +46,16 @@ module Calagator
41
46
  :mapping_provider,
42
47
  :mapping_tiles,
43
48
  :venues_map_options,
44
- :denylist_patterns
49
+ :denylist_patterns,
50
+ :devise_enabled,
51
+ :cache_enabled,
52
+ :tag_cloud_min
45
53
 
46
- self.title = "Calagator"
54
+ self.title = NAME
47
55
  self.tagline = "A Tech Calendar"
48
56
  self.url = "http://my-calagator.org/"
49
57
  self.administrator_email = "your@email.addr"
58
+ self.open_registration = true
50
59
  self.search_engine = :sql
51
60
  self.icalendar_sequence_offset = 0
52
61
  self.mapping_marker_color = "green"
@@ -57,6 +66,9 @@ module Calagator
57
66
  /\b(online|overseas).+(drugstore|pharmacy)\b/,
58
67
  /\bcialis\b/
59
68
  ]
69
+ self.devise_enabled = false
70
+ self.cache_enabled = true
71
+ self.tag_cloud_min = 10
60
72
 
61
73
  def self.configure_search_engine
62
74
  kind = search_engine.try(:to_sym)
@@ -1,33 +1,33 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rails'
4
- require 'paper_trail'
3
+ require "rails"
4
+ require "paper_trail"
5
5
 
6
6
  begin
7
- require 'will_paginate'
7
+ require "will_paginate"
8
8
  rescue LoadError
9
9
  begin
10
- require 'kaminari'
10
+ require "kaminari"
11
11
  rescue LoadError
12
- raise LoadError, 'will_paginate or kaminari must be in Gemfile or load_path'
12
+ raise LoadError, "will_paginate or kaminari must be in Gemfile or load_path"
13
13
  end
14
14
  end
15
15
 
16
16
  class PaperTrailManager < Rails::Engine
17
- initializer 'paper_trail_manager.pagination' do
17
+ initializer "paper_trail_manager.pagination" do
18
18
  ::ActionView::Base.send(:alias_method, :paginate, :will_paginate) if defined?(WillPaginate)
19
19
  end
20
20
 
21
21
  @@whodunnit_name_method = :name
22
22
  cattr_accessor :whodunnit_class, :whodunnit_name_method, :route_helpers,
23
- :layout, :base_controller, :user_path_method, :item_name_method
23
+ :layout, :base_controller, :user_path_method, :item_name_method
24
24
 
25
- self.base_controller = 'ApplicationController'
25
+ self.base_controller = "ApplicationController"
26
26
  self.user_path_method = :user_path
27
27
 
28
- (Pathname(__FILE__).dirname + '..').tap do |base|
29
- paths['app/controller'] = base + 'app/controllers'
30
- paths['app/view'] = base + 'app/views'
28
+ (Pathname(__FILE__).dirname + "..").tap do |base|
29
+ paths["app/controller"] = base + "app/controllers"
30
+ paths["app/view"] = base + "app/views"
31
31
  end
32
32
 
33
33
  cattr_accessor :allow_index_block, :allow_show_block, :allow_revert_block
data/lib/theme_reader.rb CHANGED
@@ -9,7 +9,7 @@ class ThemeReader
9
9
  rails_root = begin
10
10
  Rails.root
11
11
  rescue
12
- File.dirname(File.dirname(__FILE__))
12
+ File.dirname(__FILE__, 2)
13
13
  end
14
14
  theme_txt = "#{rails_root}/config/theme.txt"
15
15
  if ENV["THEME"]
data/rails_template.rb CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
3
  require "rubygems"
4
4
  require "pathname"
5
- require_relative './lib/calagator/version'
5
+ require_relative "lib/calagator/version"
6
6
 
7
7
  def assert_minimum_rails_version
8
8
  requirement = Gem::Requirement.new(Calagator::RAILS_VERSION)
9
9
  rails_version = Gem::Version.new(Rails::VERSION::STRING)
10
10
  return if requirement.satisfied_by?(rails_version)
11
11
 
12
- puts "Calagator requires Rails #{Calagator::RAILS_VERSION}. You are using #{rails_version}."
12
+ puts "#{Calagator::NAME} requires Rails #{Calagator::RAILS_VERSION}. You are using #{rails_version}."
13
13
  exit 1
14
14
  end
15
15
 
@@ -26,8 +26,8 @@ if options[:database] == "postgresql" && ARGV.any? { |arg| arg =~ /--postgres-us
26
26
  end
27
27
 
28
28
  # FactoryBot and Faker are required for Calagator's db:seed task
29
- spec = Gem::Specification.load(File.expand_path("calagator.gemspec", __dir__))
30
- spec ||= Gem::Specification.find_by_name("calagator")
29
+ spec = Gem::Specification.load(File.expand_path("#{Calagator::GEMSPEC}.gemspec", __dir__))
30
+ spec ||= Gem::Specification.find_by_name(Calagator::GEMSPEC)
31
31
  required_dev_gems = %w[factory_bot_rails faker]
32
32
 
33
33
  gem_group :development, :test do
@@ -41,7 +41,7 @@ gem_group :development, :test do
41
41
  end
42
42
  end
43
43
 
44
- gem "calagator", Calagator::VERSION, (generating_test_app ? {path: relative_calagator_path.to_s} : {})
44
+ gem Calagator::GEMSPEC, Calagator::VERSION, (generating_test_app ? {path: relative_calagator_path.to_s} : {})
45
45
  run "bundle install"
46
46
  rails_command "db:create"
47
47
  inside("app/assets") do
@@ -52,4 +52,4 @@ inside("app/assets") do
52
52
  MANIFEST
53
53
  end
54
54
  end
55
- generate "calagator:install", "--test-app #{generating_test_app}"
55
+ generate "calagator:install", "--test-app #{generating_test_app}"