tolaria 2.0.4 → 3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ad9a0fd53507635be02a3f66a8e48013e91c7c47
4
- data.tar.gz: ec22b6a019726b19695f2dd1bd7d258f143b86b8
2
+ SHA256:
3
+ metadata.gz: f1088a36bb83f98b7c701665d83a37ad22f6ae9365e3785d9345b98cdd133322
4
+ data.tar.gz: 9dcab578a3e5a3ec655cfd63307fa9680fedd08534c4654291c37c2f9556e207
5
5
  SHA512:
6
- metadata.gz: f07432b01569d8849aa1b06d12efe4a42aef9d20698260081f907d1614bbc98eb7ba67c201cd0f3d06f920b9028e8e4ba64da57b7b76e57bce46c6cf813991f9
7
- data.tar.gz: 2357aa1ed19e27cb05bb112e4ed006816d2cb0300852516e6cc2cba8f8e1ba534f9cfa8921ef8c35caaa6b0e525023ea6557fda704adab59f6ea667427da4e04
6
+ metadata.gz: 2a9d67623e2e304f540567358eb7b413a0d70c28d4520f81b4154764f77aacac6a0af3fdfba51155be99bc7279bef621021ebdce322be9704b48bafdabfd4572
7
+ data.tar.gz: c20a5bc1131b879206200c79e852d03d52893c6ab661e8c1547fcdccd8112fa9a0bdb8e0b15142355bc81544fa9b8d0c267ec894e79f8b9090e622adeab8ead3
@@ -1,4 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.1
3
+ - 2.6.3
4
4
  script: "rake test"
data/README.md CHANGED
@@ -21,7 +21,7 @@ Tolaria is a [content management system](https://en.wikipedia.org/wiki/Content_m
21
21
  - Easily overridable on a case-by-case basis.
22
22
  - Designed for use on Heroku, in containers, and on websites with TLS.
23
23
  - Modest dependencies.
24
- - Compatible with Rails 5 and Rails 4.2.
24
+ - Compatible with Rails 6, 5 and Rails 4.2.
25
25
 
26
26
  ### Browser Support
27
27
 
@@ -32,6 +32,9 @@ Tolaria supports IE10+, Edge, Safari, Chrome, Firefox, iOS, and Chrome for Andro
32
32
  Add Tolaria to your project's `Gemfile`:
33
33
 
34
34
  ```ruby
35
+ # If you are running Rails 6, use Tolaria 3
36
+ gem "tolaria", "~> 3.0"
37
+
35
38
  # If you are running Rails 5, use Tolaria 2
36
39
  gem "tolaria", "~> 2.0"
37
40
 
@@ -197,7 +200,7 @@ See the [TableHelper documentation](http://www.rubydoc.info/gems/tolaria/Admin/T
197
200
 
198
201
  Tolaria does not build editing forms for you, but it attempts to help speed up your work by providing a wrapper.
199
202
 
200
- If your model was `BlogPost`, you'll need to create a file in your project at `app/views/admin/blog_posts/_form.html.erb`. You'll provide the form code that would appear inside the `form_for` block, excluding the submit buttons. The builder variable is `f`.
203
+ If your model was `BlogPost`, you'll need to create a file in your project at `app/views/admin/blog_posts/_form.html.erb`. You'll provide the form code that would appear inside the `form_for` block, excluding the submit buttons. The builder variable is `f`.
201
204
 
202
205
  ```erb
203
206
  <% # app/views/admin/blog_posts/_form.html.erb %>
@@ -268,7 +271,7 @@ By default, Tolaria provides a single search field that searches over all of the
268
271
 
269
272
  **Important:** This system uses the [Ransack gem][ransack], which you'll need to familiarize yourself with.
270
273
 
271
- If your model was `BlogPost`, you'll need to create a file in your project at `app/views/admin/blog_posts/_search.html.erb`. You'll provide the form code that would appear inside the `search_form_for` block, excluding the submit buttons. The builder variable is `f`.
274
+ If your model was `BlogPost`, you'll need to create a file in your project at `app/views/admin/blog_posts/_search.html.erb`. You'll provide the form code that would appear inside the `search_form_for` block, excluding the submit buttons. The builder variable is `f`.
272
275
 
273
276
  ```erb
274
277
  <% # app/views/admin/blog_posts/_search.html.erb %>
data/Rakefile CHANGED
@@ -39,7 +39,7 @@ task :server do
39
39
  binding = ENV.fetch("BIND_ON", "0.0.0.0")
40
40
  Dir.chdir "#{TOLARIA_ROOT}/test/demo"
41
41
  system "./bin/rake db:migrate"
42
- exec "./bin/rails server --environment development --bind #{binding} --port #{port}"
42
+ exec "./bin/rails server --environment development --port #{port}"
43
43
  end
44
44
 
45
45
  desc "Start a Rails console with Tolaria loaded"
@@ -2,3 +2,5 @@
2
2
  // The actual manifest is stored in base.js.
3
3
 
4
4
  //= require admin/base.js
5
+
6
+ FormOrchestrator.initializeViewsOver("body");
@@ -9,5 +9,3 @@
9
9
  //= require_directory ./models
10
10
  //= require_directory ./views
11
11
  //= require_directory ./views/fields
12
-
13
- FormOrchestrator.initializeViewsOver("body");
@@ -120,10 +120,37 @@ var MarkdownComposerView = Backbone.View.extend({
120
120
  // Wrap each selected line in the syntax
121
121
  var replacementText = [];
122
122
  var lines = selectedText.match(/^.*((\r\n|\n|\r)|$)/gm);
123
+
123
124
  $.each(lines, function(index, value){
125
+ // strip new lines
124
126
  value = value.replace(/(\r\n|\n|\r)/, '');
125
- replacementText.push(buttonOps.before + value + buttonOps.after)
127
+
128
+ // Check if selected formatting includes a prefix and/or suffix
129
+ var hasBefore = buttonOps.before.length > 0;
130
+ var hasAfter = buttonOps.after.length > 0;
131
+ var hasBoth = hasBefore && hasAfter;
132
+
133
+ // Get prefix and suffix from selected text
134
+ var before = value.substr(0, buttonOps.before.length);
135
+ var after = value.substr(-buttonOps.after.length);
136
+
137
+ // Remove existing prefix and suffix if already applied to selected text (e.g. bold and italics)
138
+ if ( hasBoth && before === buttonOps.before && after === buttonOps.after ) {
139
+ value = value.substr(buttonOps.before.length);
140
+ value = value.substr(0, value.length - buttonOps.after.length);
141
+ replacementText.push(value);
142
+ }
143
+ // Remove prefix styling if already applied to selected text (e.g. headings, lists, and quotes)
144
+ else if ( hasBefore && before === buttonOps.before ) {
145
+ value = value.substr(buttonOps.before.length);
146
+ replacementText.push(value);
147
+ }
148
+ // Add styling
149
+ else {
150
+ replacementText.push(buttonOps.before + value + buttonOps.after)
151
+ }
126
152
  });
153
+
127
154
  this.$textarea.selection("replace", {text: replacementText.join("\n")});
128
155
  }
129
156
  else {
@@ -31,7 +31,7 @@ class Tolaria::ResourceController < Tolaria::TolariaController
31
31
  display_name = Tolaria.display_name(@resource)
32
32
 
33
33
  if @resource.save
34
- flash[:success] = "#{random_blingword} You created the #{@managed_class.model_name.human} “#{display_name}”."
34
+ flash[:success] = "#{random_blingword} You created the #{@managed_class.navigation_label.singularize} “#{display_name}”."
35
35
  return redirect_to form_completion_redirect_path(@managed_class, @resource)
36
36
  else
37
37
  log_validation_errors!
@@ -53,7 +53,7 @@ class Tolaria::ResourceController < Tolaria::TolariaController
53
53
  display_name = Tolaria.display_name(@resource)
54
54
 
55
55
  if @resource.save
56
- flash[:success] = "#{random_blingword} You updated the #{@managed_class.model_name.human.downcase} “#{display_name}”."
56
+ flash[:success] = "#{random_blingword} You updated the #{@managed_class.navigation_label.singularize.downcase} “#{display_name}”."
57
57
  return redirect_to form_completion_redirect_path(@managed_class, @resource)
58
58
  else
59
59
  log_validation_errors!
@@ -75,7 +75,7 @@ class Tolaria::ResourceController < Tolaria::TolariaController
75
75
  return redirect_to form_completion_redirect_path(@managed_class, @resource)
76
76
  end
77
77
 
78
- flash[:destructive] = "You deleted the #{@managed_class.model_name.human.downcase} “#{display_name}”."
78
+ flash[:destructive] = "You deleted the #{@managed_class.navigation_label.singularize.downcase} “#{display_name}”."
79
79
  return redirect_to form_completion_redirect_path(@managed_class)
80
80
 
81
81
  end
@@ -50,7 +50,7 @@ module Admin::ViewHelper
50
50
 
51
51
  # Returns a deletion warning message for the given ActiveRecord instance
52
52
  def deletion_warning(resource)
53
- return %{Are you sure you want to delete the #{resource.model_name.human.downcase} “#{Tolaria.display_name(resource)}”? This action is not reversible.}
53
+ return %{Are you sure you want to delete the #{@managed_class.navigation_label.singularize.downcase} “#{Tolaria.display_name(resource)}”? This action is not reversible.}
54
54
  end
55
55
 
56
56
  # Returns the correct value to pass to the `url:` of `form_for`,
@@ -9,7 +9,7 @@
9
9
  <% if managed_class.allows?(:index) %>
10
10
  <li>
11
11
  <%= tolaria_navigation_link(
12
- managed_class.model_name.human.pluralize.titleize,
12
+ managed_class.navigation_label,
13
13
  managed_class.icon,
14
14
  url_for(action:"index", controller:managed_class.plural)
15
15
  ) %>
@@ -5,13 +5,13 @@
5
5
  <div class="blank-slate">
6
6
  <span class="blank-slate-icons"><%= fontawesome_icon @managed_class.icon %></span>
7
7
  <h3 class="blank-slate-header">
8
- No <%= @managed_class.model_name.human.pluralize.titleize %> live here.
8
+ No <%= @managed_class.navigation_label %> live here.
9
9
  </h3>
10
10
  <% if @managed_class.allows?(:new) %>
11
11
  <p class="blank-slate-text">Get started on the first one:</p>
12
12
  <%= link_to url_for(action:"new"), class:"button -primary" do %>
13
13
  <%= fontawesome_icon :plus %>
14
- New <%= @managed_class.model_name.human.titleize %>
14
+ New <%= @managed_class.navigation_label.singularize %>
15
15
  <% end %>
16
16
  <% end %>
17
17
  </div>
@@ -23,7 +23,7 @@
23
23
  <div class="blank-slate">
24
24
  <span class="blank-slate-icons"><%= fontawesome_icon :search %></span>
25
25
  <h3 class="blank-slate-header">
26
- Your search didn't find any <%= @managed_class.model_name.human.pluralize.titleize %>.
26
+ Your search didn't find any <%= @managed_class.navigation_label %>.
27
27
  </h3>
28
28
  <p class="blank-slate-text">
29
29
  You can <%= link_to "clear the search form", url_for([:admin, @managed_class.klass]) %>
@@ -19,7 +19,7 @@
19
19
  <div class="search-form-controlls">
20
20
  <%= f.button type:"submit", class:"button -primary", name:nil do %>
21
21
  <%= fontawesome_icon :search %>
22
- Search <%= @managed_class.model_name.human.pluralize.titleize %>
22
+ Search <%= @managed_class.navigation_label %>
23
23
  <% end %>
24
24
  <%= link_to url_for([:admin, @managed_class.klass]), class:"button" do %>
25
25
  <%= fontawesome_icon :close %>
@@ -8,6 +8,6 @@
8
8
  <% if @managed_class.allows?(:edit) %>
9
9
  <%= link_to url_for(action:"edit", id:@resource.id), class:"button -primary" do %>
10
10
  <%= fontawesome_icon :pencil %>
11
- Edit This <%= @managed_class.model_name.human.titleize %>
11
+ Edit This <%= @managed_class.navigation_label.singularize %>
12
12
  <% end %>
13
13
  <% end %>
@@ -1,7 +1,7 @@
1
1
  <% if @resource.persisted? %>
2
2
  <%= content_for :title, "#{Tolaria.display_name(@resource)}" %>
3
3
  <% else %>
4
- <%= content_for :title, "New #{@managed_class.model_name.human.titleize}" %>
4
+ <%= content_for :title, "New #{@managed_class.navigation_label.singularize}" %>
5
5
  <% end %>
6
6
 
7
7
  <%= form_for [:admin, @resource], url:contextual_form_url, builder:Admin::FormBuilder, html:{class:"resource-form"} do |form_builder| %>
@@ -27,9 +27,9 @@
27
27
  <span class="crumb">
28
28
  <%= fontawesome_icon @managed_class.icon %>
29
29
  <% if @managed_class.allows? :index %>
30
- <%= link_to @managed_class.model_name.human.pluralize.titleize, url_for(action:"index", controller:@managed_class.plural, q:ransack_params, p:page_param) %>
30
+ <%= link_to @managed_class.navigation_label, url_for(action:"index", controller:@managed_class.plural, q:ransack_params, p:page_param) %>
31
31
  <% else %>
32
- <%= @managed_class.model_name.human.pluralize.titleize %>
32
+ <%= @managed_class.navigation_label %>
33
33
  <% end %>
34
34
  </span>
35
35
  <%= content_for :title %>
@@ -1,4 +1,4 @@
1
- <%= content_for :title, "#{@managed_class.model_name.human.pluralize.titleize}" %>
1
+ <%= content_for :title, "#{@managed_class.navigation_label}" %>
2
2
 
3
3
  <div class="main-controls">
4
4
 
@@ -28,7 +28,7 @@
28
28
  <% if @managed_class.allows?(:new) %>
29
29
  <%= link_to url_for(action:"new", q:ransack_params, p:page_param), class:"button -primary" do %>
30
30
  <%= fontawesome_icon :plus %>
31
- New <%= @managed_class.model_name.human.titleize %>
31
+ New <%= @managed_class.navigation_label.singularize %>
32
32
  <% end %>
33
33
  <% end %>
34
34
 
@@ -7,9 +7,9 @@
7
7
  <span class="crumb">
8
8
  <%= fontawesome_icon @managed_class.icon %>
9
9
  <% if @managed_class.allows? :index %>
10
- <%= link_to @managed_class.model_name.human.pluralize.titleize, url_for(action:"index", controller:@managed_class.plural, q:ransack_params, p:page_param) %>
10
+ <%= link_to @managed_class.navigation_label, url_for(action:"index", controller:@managed_class.plural, q:ransack_params, p:page_param) %>
11
11
  <% else %>
12
- <%= @managed_class.model_name.human.pluralize.titleize %>
12
+ <%= @managed_class.navigation_label %>
13
13
  <% end %>
14
14
  </span>
15
15
  <%= content_for :title %>
@@ -36,6 +36,9 @@ class ActiveRecord::Base
36
36
  # Tolaria will pass this array as the `only:` option to the router.
37
37
  # The default includes all CRUD actions:
38
38
  # `[:index, :show, :new, :create, :edit, :update, :destroy]`
39
+ # - `:navigation_label` - By default, Tolaria will label buttons, headers, and other view elements for
40
+ # this model using the string obtained from `self.model_name.human.pluralize.titleize`.
41
+ # This setting provides an override label that Tolaria will use instead.
39
42
  #
40
43
  # #### Example
41
44
  #
@@ -34,9 +34,12 @@ module Tolaria
34
34
  # A stored symbol for the `params.permit` key for this resource
35
35
  attr_accessor :param_key
36
36
 
37
+ # A String to override the model's label in the primary admin navigation
38
+ attr_accessor :navigation_label
39
+
37
40
  # A factory method that registers a new model in Tolaria and configures
38
41
  # its menu and param settings. Developers should use `ActiveRecord::Base.manage_with_tolaria`
39
- def self.create(klass, icon:"file-o", permit_params:[], priority:10, category:"Settings", default_order:"id DESC", paginated:true, allowed_actions:[:index, :show, :new, :create, :edit, :update, :destroy])
42
+ def self.create(klass, icon:"file-o", permit_params:[], priority:10, category:"Settings", default_order:"id DESC", paginated:true, allowed_actions:[:index, :show, :new, :create, :edit, :update, :destroy], navigation_label: klass.model_name.human.pluralize.titleize)
40
43
 
41
44
  managed_class = self.new
42
45
  managed_class.klass = klass
@@ -49,6 +52,7 @@ module Tolaria
49
52
  managed_class.paginated = paginated.present?
50
53
  managed_class.permitted_params = permit_params.freeze
51
54
  managed_class.allowed_actions = allowed_actions.freeze
55
+ managed_class.navigation_label = navigation_label.freeze
52
56
 
53
57
  # Set auto-generated attributes
54
58
  managed_class.controller_name = "#{managed_class.model_name.collection.camelize}Controller".freeze
@@ -2,7 +2,7 @@ module Tolaria
2
2
 
3
3
  # Returns Tolaria’s version number
4
4
  def self.version
5
- Gem::Version.new("2.0.4")
5
+ Gem::Version.new("3.0.0")
6
6
  end
7
7
 
8
8
  module VERSION
@@ -4,11 +4,12 @@ class Video < ApplicationRecord
4
4
  validates_presence_of :youtube_id
5
5
 
6
6
  manage_with_tolaria using:{
7
+ navigation_label: "YouTube Videos",
7
8
  icon: "youtube-play",
8
9
  category: "Media",
9
10
  permit_params: [
10
11
  :title,
11
- :yotube_id,
12
+ :youtube_id,
12
13
  :description,
13
14
  ],
14
15
  }
@@ -2,104 +2,104 @@
2
2
  # of editing this file, please use the migrations feature of Active Record to
3
3
  # incrementally modify your database, and then regenerate this schema definition.
4
4
  #
5
- # Note that this schema.rb definition is the authoritative source for your
6
- # database schema. If you need to create the application database on another
7
- # system, you should be using db:schema:load, not running all the migrations
8
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
- # you'll amass, the slower it'll run and the greater likelihood for issues).
5
+ # This file is the source Rails uses to define your schema when running `rails
6
+ # db:schema:load`. When creating a new database, `rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(version: 20150610135235) do
13
+ ActiveRecord::Schema.define(version: 2015_06_10_135235) do
14
14
 
15
15
  create_table "administrators", force: :cascade do |t|
16
16
  t.datetime "created_at"
17
17
  t.datetime "updated_at"
18
- t.string "email", null: false
19
- t.string "name", null: false
20
- t.string "organization", null: false
21
- t.string "passcode", limit: 60, null: false
22
- t.datetime "passcode_expires_at", null: false
23
- t.string "auth_token", limit: 32, null: false
24
- t.datetime "account_unlocks_at", null: false
25
- t.integer "lockout_strikes", default: 0, null: false
26
- t.integer "total_strikes", default: 0, null: false
27
- t.integer "sessions_created", default: 0, null: false
18
+ t.string "email", null: false
19
+ t.string "name", null: false
20
+ t.string "organization", null: false
21
+ t.string "passcode", limit: 60, null: false
22
+ t.datetime "passcode_expires_at", null: false
23
+ t.string "auth_token", limit: 32, null: false
24
+ t.datetime "account_unlocks_at", null: false
25
+ t.integer "lockout_strikes", default: 0, null: false
26
+ t.integer "total_strikes", default: 0, null: false
27
+ t.integer "sessions_created", default: 0, null: false
28
28
  t.index ["auth_token"], name: "index_administrators_on_auth_token"
29
29
  t.index ["email"], name: "index_administrators_on_email"
30
30
  end
31
31
 
32
32
  create_table "blog_post_topics", force: :cascade do |t|
33
33
  t.integer "blog_post_id", null: false
34
- t.integer "topic_id", null: false
34
+ t.integer "topic_id", null: false
35
35
  t.index ["blog_post_id"], name: "index_blog_post_topics_on_blog_post_id"
36
36
  t.index ["topic_id"], name: "index_blog_post_topics_on_topic_id"
37
37
  end
38
38
 
39
39
  create_table "blog_posts", force: :cascade do |t|
40
- t.datetime "created_at", null: false
41
- t.datetime "updated_at", null: false
42
- t.string "title", null: false
40
+ t.datetime "created_at", null: false
41
+ t.datetime "updated_at", null: false
42
+ t.string "title", null: false
43
43
  t.datetime "published_at", null: false
44
- t.text "summary"
45
- t.text "body"
46
- t.string "color"
47
- t.text "portrait"
48
- t.text "attachment"
44
+ t.text "summary"
45
+ t.text "body"
46
+ t.string "color"
47
+ t.text "portrait"
48
+ t.text "attachment"
49
49
  end
50
50
 
51
51
  create_table "footnotes", force: :cascade do |t|
52
- t.datetime "created_at", null: false
53
- t.datetime "updated_at", null: false
54
- t.integer "blog_post_id", null: false
55
- t.text "description"
56
- t.text "url"
52
+ t.datetime "created_at", null: false
53
+ t.datetime "updated_at", null: false
54
+ t.integer "blog_post_id", null: false
55
+ t.text "description"
56
+ t.text "url"
57
57
  t.index ["blog_post_id"], name: "index_footnotes_on_blog_post_id"
58
58
  end
59
59
 
60
60
  create_table "images", force: :cascade do |t|
61
- t.datetime "created_at", null: false
62
- t.datetime "updated_at", null: false
63
- t.string "title", null: false
64
- t.text "alternate_text"
65
- t.text "credit"
66
- t.text "keywords"
67
- t.text "attachment_address", null: false
61
+ t.datetime "created_at", null: false
62
+ t.datetime "updated_at", null: false
63
+ t.string "title", null: false
64
+ t.text "alternate_text"
65
+ t.text "credit"
66
+ t.text "keywords"
67
+ t.text "attachment_address", null: false
68
68
  end
69
69
 
70
70
  create_table "legal_pages", force: :cascade do |t|
71
71
  t.datetime "created_at", null: false
72
72
  t.datetime "updated_at", null: false
73
- t.string "title", null: false
74
- t.string "slug", null: false
75
- t.text "summary", null: false
76
- t.text "body"
73
+ t.string "title", null: false
74
+ t.string "slug", null: false
75
+ t.text "summary", null: false
76
+ t.text "body"
77
77
  t.index ["slug"], name: "index_legal_pages_on_slug"
78
78
  end
79
79
 
80
80
  create_table "miscellany", force: :cascade do |t|
81
- t.datetime "created_at", null: false
82
- t.datetime "updated_at", null: false
83
- t.string "key", null: false
84
- t.text "value", null: false
85
- t.text "description", null: false
81
+ t.datetime "created_at", null: false
82
+ t.datetime "updated_at", null: false
83
+ t.string "key", null: false
84
+ t.text "value", null: false
85
+ t.text "description", null: false
86
86
  t.index ["key"], name: "index_miscellany_on_key"
87
87
  end
88
88
 
89
89
  create_table "topics", force: :cascade do |t|
90
90
  t.datetime "created_at"
91
91
  t.datetime "updated_at"
92
- t.string "label", null: false
93
- t.string "slug", null: false
92
+ t.string "label", null: false
93
+ t.string "slug", null: false
94
94
  t.index ["slug"], name: "index_topics_on_slug"
95
95
  end
96
96
 
97
97
  create_table "videos", force: :cascade do |t|
98
- t.datetime "created_at", null: false
99
- t.datetime "updated_at", null: false
100
- t.string "title", null: false
101
- t.string "youtube_id", null: false
102
- t.string "description"
98
+ t.datetime "created_at", null: false
99
+ t.datetime "updated_at", null: false
100
+ t.string "title", null: false
101
+ t.string "youtube_id", null: false
102
+ t.string "description"
103
103
  end
104
104
 
105
105
  end
@@ -16,7 +16,7 @@ class FilterPreservationTest < ActionDispatch::IntegrationTest
16
16
  find_link("Organization").click
17
17
  find_link("Nintendo").click
18
18
  first(".crumb a").click
19
- assert page.current_url.include?("q[s]=organization+asc"), "filter not retained"
19
+ assert page.current_url.include?("q%5Bs%5D=organization+asc"), "filter not retained"
20
20
  end
21
21
 
22
22
  test "after filtering index, should retain filter on edit and back with button" do
@@ -25,7 +25,7 @@ class FilterPreservationTest < ActionDispatch::IntegrationTest
25
25
  find_link("Organization").click
26
26
  find_link("Nintendo").click
27
27
  first(".button.-cancel").click
28
- assert page.current_url.include?("q[s]=organization+asc"), "filter should be retained"
28
+ assert page.current_url.include?("q%5Bs%5D=organization+asc"), "filter should be retained"
29
29
  end
30
30
 
31
31
  test "after filtering index, should retain filter on edit and save" do
@@ -34,7 +34,7 @@ class FilterPreservationTest < ActionDispatch::IntegrationTest
34
34
  find_link("Organization").click
35
35
  find_link("Nintendo").click
36
36
  first(".button.-save").click
37
- assert page.current_url.include?("q[s]=organization+asc"), "filter not retained"
37
+ assert page.current_url.include?("q%5Bs%5D=organization+asc"), "filter not retained"
38
38
  end
39
39
 
40
40
  test "after filtering index, should retain filter on edit and failed validation" do
@@ -45,7 +45,7 @@ class FilterPreservationTest < ActionDispatch::IntegrationTest
45
45
  fill_in("administrator[email]", with:"")
46
46
  first(".button.-save").click
47
47
  first(".button.-cancel").click
48
- assert page.current_url.include?("q[s]=organization+asc"), "filter retained"
48
+ assert page.current_url.include?("q%5Bs%5D=organization+asc"), "filter retained"
49
49
  end
50
50
 
51
51
  test "after filtering index, should NOT retain filter on save and review" do
@@ -54,7 +54,7 @@ class FilterPreservationTest < ActionDispatch::IntegrationTest
54
54
  find_link("Organization").click
55
55
  find_link("Nintendo").click
56
56
  first(".button.-save-and-review").click
57
- assert page.current_url.exclude?("q[s]=organization+asc"), "filter not retained"
57
+ assert page.current_url.exclude?("q%5Bs%5D=organization+asc"), "filter not retained"
58
58
  end
59
59
 
60
60
  end
@@ -1,6 +1,6 @@
1
1
  require "test_helper"
2
2
 
3
- class CreateCardsMigration < ActiveRecord::Migration
3
+ class CreateCardsMigration < ActiveRecord::Migration[5.0]
4
4
  def change
5
5
  create_table :cards, force:true do |t|
6
6
  t.timestamps null:false
@@ -0,0 +1,45 @@
1
+ require "test_helper"
2
+
3
+ class NavigationLabelTest < ActionDispatch::IntegrationTest
4
+
5
+ def setup
6
+ Video.destroy_all
7
+ end
8
+
9
+ def teardown
10
+ Video.destroy_all
11
+ end
12
+
13
+ test "navigation label is overidden" do
14
+
15
+ sign_in_dummy_administrator!
16
+
17
+ # index view is overridden
18
+ visit("/admin/videos")
19
+ assert page.has_content?("YouTube Videos")
20
+ assert page.has_content?("New YouTube Video")
21
+ assert page.has_content?("No YouTube Videos live here")
22
+
23
+ # new/edit view is overriden
24
+ first(".button.-primary").click
25
+ assert page.has_content?("New YouTube Video")
26
+ fill_in("video[title]", with:"Neko Atsume")
27
+ fill_in("video[youtube_id]", with:"xxxxxxxxxxx")
28
+ first(".button[name=save]").click
29
+
30
+ # created flash message is overridden
31
+ assert page.has_content?("created the YouTube Video"), "should see flash message"
32
+
33
+ # show view is overriden
34
+ find_link("Inspect").click
35
+ assert page.has_content?("YouTube Videos")
36
+ assert page.has_content?("Edit This YouTube Video")
37
+
38
+ # updated flash message is overriden
39
+ first(".button.-primary").click
40
+ first(".button[name=save]").click
41
+ assert page.has_content?("updated the youtube video"), "should see flash message"
42
+
43
+ end
44
+
45
+ end
@@ -33,8 +33,8 @@ class SessionTest < ActionDispatch::IntegrationTest
33
33
 
34
34
  test "admin form fields should be empty" do
35
35
  visit "/admin/signin"
36
- assert_equal nil, find("#session-form-email").value()
37
- assert_equal nil, find("#session-form-passcode", visible:false).value()
36
+ assert_nil find("#session-form-email").value
37
+ assert_nil find("#session-form-passcode", visible: false).value
38
38
  end
39
39
 
40
40
  test "session form doesn't explode when junk submitted" do
@@ -6,6 +6,7 @@ class ManagedClassesTest < ActiveSupport::TestCase
6
6
 
7
7
  class ::Card < ActiveRecord::Base
8
8
  manage_with_tolaria using:{
9
+ navigation_label: "Widgets",
9
10
  icon: "credit-card",
10
11
  priority: 5,
11
12
  category: "Payments",
@@ -32,6 +33,9 @@ class ManagedClassesTest < ActiveSupport::TestCase
32
33
  assert_equal managed_class.allowed_actions, [:index, :show]
33
34
  assert managed_class.paginated, true
34
35
 
36
+ # Can we override the navigation label?
37
+ assert_equal managed_class.navigation_label, "Widgets"
38
+
35
39
  # Can we check action allowances?
36
40
  assert managed_class.allows?(:index), "should allow `index` action"
37
41
  assert managed_class.allows?(:show), "should allow `show` action"
@@ -9,7 +9,7 @@ class MenuTest < ActiveSupport::TestCase
9
9
  test "menu categories supersede class categories" do
10
10
  old_setting = Tolaria.config.menu_categories
11
11
  Tolaria.config.menu_categories = ["Bull", "Krem"]
12
- assert_equal ["Bull", "Krem", "Settings", "Prose", "Media"], Tolaria.categories
12
+ assert_equal ["Bull", "Krem", "Settings", "Media", "Prose"], Tolaria.categories
13
13
  Tolaria.config.menu_categories = old_setting
14
14
  end
15
15
 
@@ -17,17 +17,18 @@ Gem::Specification.new do |s|
17
17
  s.test_files = `git ls-files --directory test`.split("\n")
18
18
  s.require_paths = ["lib"]
19
19
 
20
- s.required_ruby_version = ">= 2.3"
20
+
21
+ s.required_ruby_version = ">= 2.6"
21
22
 
22
23
  s.add_dependency "bcrypt", "~> 3.1"
23
- s.add_dependency "kaminari", "~> 0.16"
24
- s.add_dependency "rails", "~> 5.0"
25
- s.add_dependency "ransack", "~> 1.8"
26
- s.add_dependency "sass-rails", "~> 5.0"
24
+ s.add_dependency "kaminari", "~> 1.1.1"
25
+ s.add_dependency "rails", "~> 6.0.0"
26
+ s.add_dependency "ransack", "~> 2.3"
27
+ s.add_dependency "sass-rails", "~> 6.0"
27
28
  s.add_dependency "sass", "~> 3.0"
28
29
 
29
- s.add_development_dependency "capybara", "~> 2.4"
30
- s.add_development_dependency "minitest", "~> 5.7"
30
+ s.add_development_dependency "capybara", "~> 3.28"
31
+ s.add_development_dependency "minitest", "~> 5.11"
31
32
  s.add_development_dependency "redcarpet", "~> 3"
32
33
  s.add_development_dependency "sqlite3", "~> 1.3"
33
34
  s.add_development_dependency "timecop", "~> 0.7"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tolaria
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Csuhta
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-10-19 00:00:00.000000000 Z
12
+ date: 2020-02-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bcrypt
@@ -31,56 +31,56 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '0.16'
34
+ version: 1.1.1
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0.16'
41
+ version: 1.1.1
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rails
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '5.0'
48
+ version: 6.0.0
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '5.0'
55
+ version: 6.0.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: ransack
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '1.8'
62
+ version: '2.3'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '1.8'
69
+ version: '2.3'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: sass-rails
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '5.0'
76
+ version: '6.0'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '5.0'
83
+ version: '6.0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: sass
86
86
  requirement: !ruby/object:Gem::Requirement
@@ -101,28 +101,28 @@ dependencies:
101
101
  requirements:
102
102
  - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: '2.4'
104
+ version: '3.28'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: '2.4'
111
+ version: '3.28'
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: minitest
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: '5.7'
118
+ version: '5.11'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: '5.7'
125
+ version: '5.11'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: redcarpet
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -398,6 +398,7 @@ files:
398
398
  - test/integration/filter_preservation_test.rb
399
399
  - test/integration/forbidden_routes_test.rb
400
400
  - test/integration/help_link_test.rb
401
+ - test/integration/navigation_label_test.rb
401
402
  - test/integration/pagination_test.rb
402
403
  - test/integration/router_test.rb
403
404
  - test/integration/session_test.rb
@@ -420,15 +421,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
420
421
  requirements:
421
422
  - - ">="
422
423
  - !ruby/object:Gem::Version
423
- version: '2.3'
424
+ version: '2.6'
424
425
  required_rubygems_version: !ruby/object:Gem::Requirement
425
426
  requirements:
426
427
  - - ">="
427
428
  - !ruby/object:Gem::Version
428
429
  version: '0'
429
430
  requirements: []
430
- rubyforge_project:
431
- rubygems_version: 2.6.4
431
+ rubygems_version: 3.0.3
432
432
  signing_key:
433
433
  specification_version: 4
434
434
  summary: A Rails CMS framework for making people happy.
@@ -494,6 +494,7 @@ test_files:
494
494
  - test/integration/filter_preservation_test.rb
495
495
  - test/integration/forbidden_routes_test.rb
496
496
  - test/integration/help_link_test.rb
497
+ - test/integration/navigation_label_test.rb
497
498
  - test/integration/pagination_test.rb
498
499
  - test/integration/router_test.rb
499
500
  - test/integration/session_test.rb