archangel 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +10 -2
  3. data/Gemfile +1 -1
  4. data/README.md +3 -3
  5. data/Rakefile +10 -7
  6. data/app/controllers/archangel/backend/sites_controller.rb +1 -2
  7. data/app/controllers/archangel/backend/users_controller.rb +1 -1
  8. data/app/controllers/concerns/archangel/seoable_concern.rb +1 -2
  9. data/app/models/archangel/entry.rb +1 -1
  10. data/app/models/archangel/page.rb +2 -4
  11. data/app/models/archangel/site.rb +0 -4
  12. data/app/models/archangel/template.rb +9 -0
  13. data/app/themes/default/assets/javascripts/default/backend.js +1 -0
  14. data/app/themes/default/assets/javascripts/default/backend/templates.js +26 -0
  15. data/app/themes/default/assets/stylesheets/default/auth/core.scss +10 -5
  16. data/app/themes/default/assets/stylesheets/default/backend/bootstrap/_tables.scss +40 -0
  17. data/app/themes/default/assets/stylesheets/default/backend/core.scss +11 -10
  18. data/app/themes/default/assets/stylesheets/default/frontend/core.scss +10 -5
  19. data/app/themes/default/views/layouts/auth.html.erb +0 -2
  20. data/app/themes/default/views/layouts/backend.html.erb +0 -2
  21. data/app/views/archangel/backend/assets/_asset.html.erb +12 -0
  22. data/app/views/archangel/backend/assets/index.html.erb +1 -14
  23. data/app/views/archangel/backend/collections/_collection.html.erb +10 -0
  24. data/app/views/archangel/backend/collections/index.html.erb +1 -12
  25. data/app/views/archangel/backend/entries/_entry.html.erb +13 -0
  26. data/app/views/archangel/backend/entries/index.html.erb +1 -15
  27. data/app/views/archangel/backend/pages/_page.html.erb +17 -0
  28. data/app/views/archangel/backend/pages/index.html.erb +1 -19
  29. data/app/views/archangel/backend/sites/_form.html.erb +0 -6
  30. data/app/views/archangel/backend/templates/_template.html.erb +10 -0
  31. data/app/views/archangel/backend/templates/index.html.erb +1 -12
  32. data/app/views/archangel/backend/users/_user.html.erb +11 -0
  33. data/app/views/archangel/backend/users/index.html.erb +1 -13
  34. data/app/views/archangel/backend/widgets/_widget.html.erb +10 -0
  35. data/app/views/archangel/backend/widgets/index.html.erb +1 -12
  36. data/bin/citest +3 -0
  37. data/bin/test +4 -0
  38. data/config/locales/active_record.en.yml +0 -2
  39. data/config/locales/en.yml +3 -3
  40. data/db/migrate/20171003191001_create_archangel_sites.rb +0 -1
  41. data/docs/Developers.md +2 -11
  42. data/docs/Extension/Developers.md +1 -1
  43. data/docs/Release.md +7 -1
  44. data/lib/archangel.rb +13 -0
  45. data/lib/archangel/command/templates/extension/Gemfile +0 -1
  46. data/lib/archangel/command/templates/extension/README.md +2 -11
  47. data/lib/archangel/command/templates/extension/Rakefile +4 -0
  48. data/lib/archangel/config.rb +5 -3
  49. data/lib/archangel/engine.rb +1 -1
  50. data/lib/archangel/liquid/drop.rb +1 -67
  51. data/lib/archangel/liquid/drops/site_drop.rb +0 -8
  52. data/lib/archangel/testing_support/factories/archangel_assets.rb +0 -5
  53. data/lib/archangel/testing_support/factories/archangel_sites.rb +0 -4
  54. data/lib/archangel/testing_support/support.rb +0 -4
  55. data/lib/archangel/version.rb +1 -1
  56. data/lib/generators/archangel/dummy/dummy_generator.rb +49 -27
  57. data/lib/generators/archangel/dummy/templates/config/database.yml +1 -1
  58. data/lib/generators/archangel/install/templates/config/archangel.yml +1 -18
  59. data/spec/controllers/archangel/backend/assets_controller_spec.rb +0 -11
  60. data/spec/controllers/archangel/backend/sites_controller_spec.rb +0 -16
  61. data/spec/features/backend/{duplicate_page_slugs_spec.rb → pages/duplicate_slugs_spec.rb} +0 -0
  62. data/spec/features/frontend/{drop_variables_spec.rb → liquid_drop_variables_spec.rb} +0 -2
  63. data/spec/features/frontend/{homepage_redirect_spec.rb → pages/homepage_redirect_spec.rb} +0 -0
  64. data/spec/lib/archangel/liquid/drops/site_drop_spec.rb +0 -5
  65. data/spec/lib/archangel/liquid/tags/asset_tag_spec.rb +2 -1
  66. data/spec/models/archangel/entry_spec.rb +4 -4
  67. data/spec/models/archangel/page_spec.rb +4 -4
  68. data/spec/models/archangel/template_spec.rb +14 -0
  69. data/spec/support/.keep +0 -0
  70. data/spec/uploaders/archangel/asset_uploader_spec.rb +1 -24
  71. data/vendor/assets/stylesheets/daterangepicker/_daterangepicker.scss +0 -2
  72. metadata +17 -10
  73. data/app/assets/images/archangel/fallback/favicon.ico +0 -0
  74. data/app/uploaders/archangel/favicon_uploader.rb +0 -38
  75. data/docs/Extension/Ideas.md +0 -133
  76. data/spec/support/coveralls.rb +0 -5
  77. data/spec/uploaders/archangel/favicon_uploader_spec.rb +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f93fdac4c77817cecce54f5e7858937109ca282476a44d9700ab80be221de8b
4
- data.tar.gz: 47a9de320b4483ade84a1daad9b4323293c539ab311b59def727f4592334d8e1
3
+ metadata.gz: 1ada0c8ed4af07cb9635a364c3ac186aaeff079823aa2d63113b9386faa5dd74
4
+ data.tar.gz: 59820ae9c8fed07aef979c3f44eec939645e611bb05ce104b53ff54c9f4904f2
5
5
  SHA512:
6
- metadata.gz: 7edcc97f656802011fc4fdfc841334706393bd7415badc423e22dcc98c6de14390071e2b05326f25341867f9804bf7276a74456275f216f8506625e73c3c4345
7
- data.tar.gz: 727fc92ce25f28c0f41fd935952d86f90cb4593ac60b02935e26a812fdab36ea28638d179c037f2b59f829ea0e8cb3bea2d0a77d3c8c8eac536f2e260f322a37
6
+ metadata.gz: f6169656cff9ed37878dc356ce5a47a61745e3829ed2d94fc646f5ede5017c84fa5587e28a7bffe1e3e0ed798ebfc3fb50b8b0a1b50a699fdc53c024fb80cc82
7
+ data.tar.gz: 5c6be4b10f12046913e9723f42fbb96cd28ccf138b938fa30cc0152b0570a0dc8a9f99aef3b293281855fa9da1031782d3330ec517922b3731c5b780e712a9b9
@@ -2,14 +2,22 @@ sudo: false
2
2
  language: ruby
3
3
  cache:
4
4
  bundler: true
5
+ env:
6
+ global:
7
+ - CC_TEST_REPORTER_ID=10625f04e4c8c9fe7c22d49639163f1427fe16bc253aabcb316edbe43c41270b
5
8
  bundler_args: --without production --jobs=3 --retry=3
6
9
  before_install:
7
10
  - gem update --system
8
11
  - gem --version
9
12
  install: ruby -S bundle install
13
+ before_script:
14
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
15
+ - chmod +x ./cc-test-reporter
16
+ - ./cc-test-reporter before-build
10
17
  script:
11
- - bundle exec rake dummy_app
12
- - bundle exec rake spec
18
+ - bin/citest
19
+ after_script:
20
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
13
21
  rvm:
14
22
  - 2.2.10
15
23
  - 2.3.7
data/Gemfile CHANGED
@@ -18,13 +18,13 @@ end
18
18
 
19
19
  group :development, :test do
20
20
  gem "launchy", "~> 2.4"
21
+ gem "pg", "~> 1.0"
21
22
  gem "pry-byebug", "~> 3.5"
22
23
  gem "sqlite3", ">= 1.3", platforms: %i[ruby mswin mswin64 mingw x64_mingw]
23
24
  end
24
25
 
25
26
  group :test do
26
27
  gem "capybara", "~> 3.0"
27
- gem "coveralls", "~> 0.8"
28
28
  gem "database_cleaner", "~> 1.6"
29
29
  gem "factory_bot_rails", "~> 4.8"
30
30
  gem "poltergeist", "~> 1.18"
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  ** Archangel is currently under development. It is not ready for production use. **
4
4
 
5
5
  [![Travis CI](https://travis-ci.org/archangel/archangel.svg?branch=master)](https://travis-ci.org/archangel/archangel)
6
- [![Coverage Status](https://coveralls.io/repos/github/archangel/archangel/badge.svg?branch=master)](https://coveralls.io/github/archangel/archangel?branch=master)
6
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/ecd913526457e79b49bd/test_coverage)](https://codeclimate.com/github/archangel/archangel/test_coverage)
7
7
  [![Code Climate](https://codeclimate.com/github/archangel/archangel/badges/gpa.svg)](https://codeclimate.com/github/archangel/archangel)
8
8
  [![Inline docs](http://inch-ci.org/github/archangel/archangel.svg?branch=master)](http://inch-ci.org/github/archangel/archangel)
9
9
 
@@ -31,7 +31,7 @@ Deploy a sample application to [Heroku](https://www.heroku.com/) to play with.
31
31
  Add to your application's Gemfile
32
32
 
33
33
  ```
34
- gem "archangel"
34
+ gem "archangel", "< 1.0"
35
35
  ```
36
36
 
37
37
  Run the bundle command
@@ -52,7 +52,7 @@ Run the install generator with seed data
52
52
  $ bundle exec rails g archangel:install --seed
53
53
  ```
54
54
 
55
- Seed data can be created separately by running `rake db:seed`
55
+ Seed data can be created separately by running `bundle exec rails db:seed`
56
56
 
57
57
  ## Updating
58
58
 
data/Rakefile CHANGED
@@ -17,13 +17,6 @@ RSpec::Core::RakeTask.new
17
17
 
18
18
  task default: :spec
19
19
 
20
- desc "Generates a dummy app for Archangel"
21
- task :dummy_app do
22
- ENV["LIB_NAME"] = "archangel"
23
-
24
- Rake::Task["dummy:generate"].invoke
25
- end
26
-
27
20
  desc "Remove any generated files and directories"
28
21
  task :clean do
29
22
  %w[
@@ -34,3 +27,13 @@ task :clean do
34
27
  .yardoc coverage doc pkg archangel_* node_modules pkg spec/dummy
35
28
  ].each { |directory| rm_rf directory }
36
29
  end
30
+
31
+ desc "Generates a dummy app for Archangel"
32
+ task :dummy_app do
33
+ ENV["LIB_NAME"] = "archangel"
34
+
35
+ Rake::Task["dummy:generate"].invoke
36
+ end
37
+
38
+ desc "Run RSpec tests"
39
+ task test: :spec
@@ -145,8 +145,7 @@ module Archangel
145
145
  protected
146
146
 
147
147
  def permitted_attributes
148
- %w[favicon locale logo meta_description meta_keywords name
149
- remove_favicon remove_logo theme]
148
+ %w[locale logo meta_description meta_keywords name remove_logo theme]
150
149
  end
151
150
 
152
151
  def set_resource
@@ -309,6 +309,7 @@ module Archangel
309
309
  def set_resources
310
310
  @users = current_site.users
311
311
  .where.not(id: current_user.id)
312
+ .order(name: :asc)
312
313
  .page(page_num).per(per_page)
313
314
 
314
315
  authorize @users
@@ -319,7 +320,6 @@ module Archangel
319
320
 
320
321
  @user = current_site.users
321
322
  .where.not(id: current_user.id)
322
- .order(name: :asc)
323
323
  .find_by!(username: resource_id)
324
324
 
325
325
  authorize @user
@@ -32,8 +32,7 @@ module Archangel
32
32
  canonical: request.url,
33
33
  image_src: current_site.logo.url,
34
34
  description: current_site.meta_description,
35
- keywords: current_site.meta_keywords.to_s.split(","),
36
- icon: current_site.favicon.url
35
+ keywords: current_site.meta_keywords.to_s.split(",")
37
36
  }
38
37
  end
39
38
  end
@@ -34,7 +34,7 @@ module Archangel
34
34
  #
35
35
  # @return [String] available status
36
36
  #
37
- def available_status
37
+ def status
38
38
  if available?
39
39
  if available_at > Time.now
40
40
  "future-available"
@@ -57,7 +57,7 @@ module Archangel
57
57
  #
58
58
  # @return [String] publication status
59
59
  #
60
- def published_status
60
+ def status
61
61
  if published?
62
62
  if published_at > Time.now
63
63
  "future-published"
@@ -132,9 +132,7 @@ module Archangel
132
132
  end
133
133
 
134
134
  def reserved_paths
135
- Archangel.config.to_h.select do |key, _val|
136
- %i[auth_path backend_path frontend_path].include?(key)
137
- end.values
135
+ Archangel.config.keys_in(Archangel.reserved_page_keywords).values
138
136
  end
139
137
  end
140
138
  end
@@ -7,12 +7,8 @@ module Archangel
7
7
  class Site < ApplicationRecord
8
8
  acts_as_paranoid
9
9
 
10
- mount_uploader :favicon, Archangel::FaviconUploader
11
10
  mount_uploader :logo, Archangel::LogoUploader
12
11
 
13
- validates :favicon, file_size: {
14
- less_than_or_equal_to: Archangel.config.favicon_maximum_file_size
15
- }
16
12
  validates :locale, presence: true, inclusion: { in: Archangel::LANGUAGES }
17
13
  validates :logo, file_size: {
18
14
  less_than_or_equal_to: Archangel.config.image_maximum_file_size
@@ -18,6 +18,15 @@ module Archangel
18
18
  optional: true
19
19
  belongs_to :site
20
20
 
21
+ ##
22
+ # Return string of partial status.
23
+ #
24
+ # @return [String] partial status
25
+ #
26
+ def status
27
+ partial? ? "partial" : "full"
28
+ end
29
+
21
30
  protected
22
31
 
23
32
  def valid_liquid_content
@@ -46,3 +46,4 @@
46
46
  //= require default/common/flash
47
47
  //
48
48
  //= require default/backend/core
49
+ //= require default/backend/templates
@@ -0,0 +1,26 @@
1
+ $(function() {
2
+ 'use strict';
3
+
4
+ // New Template
5
+ $('#template_partial').change(function() {
6
+ var checked = this.checked;
7
+
8
+ if (checked === true) {
9
+ $('#template_parent_id option:selected').prop('selected', false);
10
+ }
11
+
12
+ $('.new_template .template_parent').toggle(!checked);
13
+ });
14
+
15
+ // Edit Template
16
+ $('#template_partial').change(function() {
17
+ var checked = this.checked;
18
+
19
+ if (checked === true) {
20
+ $('#template_parent_id option:selected').prop('selected', false);
21
+ }
22
+
23
+ $('.edit_template .template_parent').toggle(!checked);
24
+ }).trigger('change');
25
+
26
+ });
@@ -1,15 +1,20 @@
1
- // Bootstrap theme variables
1
+ // Theme variables
2
2
  //
3
3
  @import '../common/variables';
4
4
  //
5
- // Bootstrap
5
+ // 3rd party (from gems)
6
6
  //
7
7
  @import 'bootstrap';
8
+ @import 'font-awesome';
9
+ //
10
+ // 3rd party (from vendor)
8
11
  //
9
- // Bootstrap theme
12
+ // none
13
+ //
14
+ // 3rd party overwrites
10
15
  //
11
16
  @import '../common/bootstrap';
12
17
  //
13
- // 3rd party
18
+ // Theme styles
14
19
  //
15
- @import 'font-awesome';
20
+ // none
@@ -0,0 +1,40 @@
1
+ .table {
2
+ tr {
3
+ &.entry-available,
4
+ &.entry-future-available,
5
+ &.entry-unavailable,
6
+ &.page-future-published,
7
+ &.page-published,
8
+ &.page-unpublished,
9
+ &.template-full,
10
+ &.template-partial {
11
+ td:first-child {
12
+ border-left-style: solid;
13
+ border-left-width: 2px;
14
+ }
15
+ }
16
+
17
+ &.entry-available,
18
+ &.page-published,
19
+ &.template-full {
20
+ td:first-child {
21
+ border-left-color: $green;
22
+ }
23
+ }
24
+
25
+ &.entry-unavailable,
26
+ &.page-unpublished,
27
+ &.template-partial {
28
+ td:first-child {
29
+ border-left-color: $cyan;
30
+ }
31
+ }
32
+
33
+ &.entry-future-available,
34
+ &.page-future-published {
35
+ td:first-child {
36
+ border-left-color: $orange;
37
+ }
38
+ }
39
+ }
40
+ }
@@ -1,18 +1,10 @@
1
- // Bootstrap theme variables
1
+ // Theme variables
2
2
  //
3
3
  @import '../common/variables';
4
4
  //
5
- // Bootstrap
6
- //
7
- @import 'bootstrap';
8
- //
9
- // Bootstrap theme
10
- //
11
- @import '../common/bootstrap';
12
- @import '../common/selectize';
13
- //
14
5
  // 3rd party (from gems)
15
6
  //
7
+ @import 'bootstrap';
16
8
  @import 'font-awesome';
17
9
  //
18
10
  // 3rd party (from vendor)
@@ -20,3 +12,12 @@
20
12
  @import 'daterangepicker/daterangepicker';
21
13
  @import 'trumbowyg/trumbowyg';
22
14
  @import 'trumbowyg/plugins/colors/trumbowyg.colors';
15
+ //
16
+ // 3rd party overwrites
17
+ //
18
+ @import '../common/bootstrap';
19
+ @import '../common/selectize';
20
+ //
21
+ // Theme styles
22
+ //
23
+ @import 'bootstrap/tables';
@@ -1,15 +1,20 @@
1
- // Bootstrap theme variables
1
+ // Theme variables
2
2
  //
3
3
  @import '../common/variables';
4
4
  //
5
- // Bootstrap
5
+ // 3rd party (from gems)
6
6
  //
7
7
  @import 'bootstrap';
8
+ @import 'font-awesome';
9
+ //
10
+ // 3rd party (from vendor)
8
11
  //
9
- // Bootstrap theme
12
+ // none
13
+ //
14
+ // 3rd party overwrites
10
15
  //
11
16
  @import '../common/bootstrap';
12
17
  //
13
- // 3rd party
18
+ // Theme styles
14
19
  //
15
- @import 'font-awesome';
20
+ // none
@@ -6,8 +6,6 @@
6
6
 
7
7
  <title><%= content_for?(:title) ? yield(:title) : Archangel.t(:archangel) %></title>
8
8
 
9
- <link rel="shortcut icon" href="<%= current_site.favicon.url %>">
10
-
11
9
  <%= csrf_meta_tags %>
12
10
 
13
11
  <%= stylesheet_link_tag "#{current_theme}/auth", media: "all" %>
@@ -6,8 +6,6 @@
6
6
 
7
7
  <title><%= content_for?(:title) ? yield(:title) : Archangel.t(:archangel) %></title>
8
8
 
9
- <link rel="shortcut icon" href="<%= current_site.favicon.url %>">
10
-
11
9
  <%= csrf_meta_tags %>
12
10
 
13
11
  <%= stylesheet_link_tag "#{current_theme}/backend", media: "all" %>
@@ -0,0 +1,12 @@
1
+ <tr>
2
+ <td><%= image_tag(asset.file.tiny.url, alt: asset.file_name) %></td>
3
+ <td><%= asset.file_name %></td>
4
+ <td><%= asset.content_type %></td>
5
+ <td><%= number_to_human_size(asset.file_size) %></td>
6
+ <td class="actions text-right">
7
+ <%= link_to(fa_icon("info-circle", text: Archangel.t(:show)), backend_asset_path(asset), class: "btn btn-info btn-sm") %>
8
+ <%= link_to(fa_icon("check-circle", text: Archangel.t(:edit)), edit_backend_asset_path(asset), class: "btn btn-warning btn-sm") %>
9
+ <%= link_to(fa_icon("times-circle", text: Archangel.t(:destroy)), backend_asset_path(asset), class: "btn btn-danger btn-sm",
10
+ method: :delete, data: { confirm: Archangel.t(:are_you_sure) }) %>
11
+ </td>
12
+ </tr>
@@ -30,20 +30,7 @@
30
30
  </thead>
31
31
 
32
32
  <tbody>
33
- <% @assets.each do |asset| %>
34
- <tr>
35
- <td><%= image_tag(asset.file.tiny.url, alt: asset.file_name) %></td>
36
- <td><%= asset.file_name %></td>
37
- <td><%= asset.content_type %></td>
38
- <td><%= number_to_human_size(asset.file_size) %></td>
39
- <td class="actions text-right">
40
- <%= link_to(fa_icon("info-circle", text: Archangel.t(:show)), backend_asset_path(asset), class: "btn btn-info btn-sm") %>
41
- <%= link_to(fa_icon("check-circle", text: Archangel.t(:edit)), edit_backend_asset_path(asset), class: "btn btn-warning btn-sm") %>
42
- <%= link_to(fa_icon("times-circle", text: Archangel.t(:destroy)), backend_asset_path(asset), class: "btn btn-danger btn-sm",
43
- method: :delete, data: { confirm: Archangel.t(:are_you_sure) }) %>
44
- </td>
45
- </tr>
46
- <% end %>
33
+ <%= render partial: "asset", collection: @assets %>
47
34
  </tbody>
48
35
  </table>
49
36
  </div>
@@ -0,0 +1,10 @@
1
+ <tr>
2
+ <td><%= collection.name %></td>
3
+ <td><%= collection.slug %></td>
4
+ <td class="actions text-right">
5
+ <%= link_to(fa_icon("info-circle", text: Archangel.t(:show)), backend_collection_path(collection), class: "btn btn-info btn-sm") %>
6
+ <%= link_to(fa_icon("check-circle", text: Archangel.t(:edit)), edit_backend_collection_path(collection), class: "btn btn-warning btn-sm") %>
7
+ <%= link_to(fa_icon("times-circle", text: Archangel.t(:destroy)), backend_collection_path(collection), class: "btn btn-danger btn-sm",
8
+ method: :delete, data: { confirm: Archangel.t(:are_you_sure) }) %>
9
+ </td>
10
+ </tr>
@@ -28,18 +28,7 @@
28
28
  </thead>
29
29
 
30
30
  <tbody>
31
- <% @collections.each do |collection| %>
32
- <tr>
33
- <td><%= collection.name %></td>
34
- <td><%= collection.slug %></td>
35
- <td class="actions text-right">
36
- <%= link_to(fa_icon("info-circle", text: Archangel.t(:show)), backend_collection_path(collection), class: "btn btn-info btn-sm") %>
37
- <%= link_to(fa_icon("check-circle", text: Archangel.t(:edit)), edit_backend_collection_path(collection), class: "btn btn-warning btn-sm") %>
38
- <%= link_to(fa_icon("times-circle", text: Archangel.t(:destroy)), backend_collection_path(collection), class: "btn btn-danger btn-sm",
39
- method: :delete, data: { confirm: Archangel.t(:are_you_sure) }) %>
40
- </td>
41
- </tr>
42
- <% end %>
31
+ <%= render partial: "collection", collection: @collections %>
43
32
  </tbody>
44
33
  </table>
45
34
  </div>