ecm_blog_backend 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf54d74924f38d51e586a0c55ba652bb3cf86a70
4
- data.tar.gz: ebbbb159658337c88bb8016cbcedf5e7e25e3e58
3
+ metadata.gz: 3aa3145088e060b5f50a4db16d689da4cf239f4d
4
+ data.tar.gz: 3d9976886bf33cd10d9c0a8beaa72fc485afdcd4
5
5
  SHA512:
6
- metadata.gz: 74c79abec7e9c431ff92430357d2f45e56141a77d1c80af27f843e0e9bef4eb498f99909b1111b99e40516fbeab8fddbd672f2656c6e41764cd59831ed6022ac
7
- data.tar.gz: 7945091a943136644930090987df3bd3a8cfe8151f3deaeb22c4110ab41074d5bb5559a55aba1c0312e81b767b891ded591d8b95a6d2dcea3dfbe8d5708fb319
6
+ metadata.gz: 64d3b2b537e07be45d61c45ce12ba059d52728e5aca136c976b23702b2ce0b0aee3f52fd781e239f9b951cc9f710a012f2f596673380beeacc6c026ba7134770
7
+ data.tar.gz: f461d8a555100980e1fbc6c1ad5651e1dc72615660e9ea443180816831d872203f082d6734419d39d0499940ad42c8a05758efd649e4e5ee4e87d4d1af1135d6
@@ -0,0 +1,31 @@
1
+ module Ecm
2
+ module Blog
3
+ module Backend
4
+ class AssetDetailsController < Itsf::Backend::Resource::BaseController
5
+ include ResourcesController::ActsAsListConcern
6
+ include ResourcesController::ActsAsPublishedConcern
7
+ include ResourcesController::Sorting
8
+
9
+ helper Twitter::Bootstrap::Components::Rails::V3::ComponentsHelper
10
+
11
+ def self.resource_class
12
+ Ecm::Blog::AssetDetail
13
+ end
14
+
15
+ private
16
+
17
+ def after_destroy_location
18
+ last_location
19
+ end
20
+
21
+ def after_reposition_location
22
+ last_location
23
+ end
24
+
25
+ def permitted_params
26
+ params.require(:asset_detail).permit(:title, :description)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -32,7 +32,7 @@ module Ecm
32
32
  end
33
33
 
34
34
  def permitted_params
35
- params.require(:post).permit(:title, :body, :published, :tag_list)
35
+ params.require(:post).permit(:title, :body, :published, :tag_list, assets: [])
36
36
  end
37
37
  end
38
38
  end
@@ -0,0 +1,10 @@
1
+ = table.acts_as_list_actions
2
+ = table.id sort: true
3
+ = table.association :post do |resource|
4
+ - link_to(resource.post.title, resource.post)
5
+ = table.association :asset, label_method: ->(r) { r.filename }
6
+ = table.timestamps sort: true
7
+ = table.column :asset_actions do |resource|
8
+ - link_to(main_app.url_for(resource.asset), class: 'btn btn-xs btn-primary') do
9
+ %span.glyphicon.glyphicon-download
10
+ = t('.download')
@@ -10,4 +10,5 @@
10
10
  = form.input :title
11
11
  = form.input :body, input_html: { 'data-add-editor': Itsf::Backend.features?(:'ace-rails-ap') } #, 'data-editor-syntax': form.object.handler }
12
12
  = form.input :published, as: :boolean
13
- = form.input :tag_list
13
+ = form.input :tag_list
14
+ = form.input :assets, as: :file, input_html: { multiple: true }
@@ -0,0 +1,26 @@
1
+ - if @resource.asset_details.any?
2
+ = collection_table(collection: @resource.asset_details) do |t|
3
+ = t.acts_as_list_actions
4
+ = t.column(:preview_picture) do |resource|
5
+ - capture_haml do
6
+ - begin
7
+ %img.img-responsive.bottom-margin-2{ src: main_app.url_for(resource.asset.variant(thumbnail: '160x120^')) }
8
+ - rescue ActiveStorage::InvariableError
9
+ = t.column :filename
10
+ = t.column :asset_actions do |resource|
11
+ - link_to(main_app.url_for(resource.asset), class: 'btn btn-xs btn-primary btn-responsive') do
12
+ %span.glyphicon.glyphicon-download
13
+ %span.btn-text= t('.download')
14
+ = t.column :actions do |resource|
15
+ - capture_haml do
16
+ - id_base = "link-to-#{controller.class.name.underscore.gsub('_controller', '').gsub(/[\/_]/, '-')}-#{resource.to_param}"
17
+ .btn-group
18
+ = link_to(resource, id: "#{id_base}-show", class: 'btn btn-xs btn-responsive btn-primary') do
19
+ %span.glyphicon.glyphicon-eye-open
20
+ %span.btn-text= t('.show')
21
+ = link_to([:edit, resource], id: "#{id_base}-edit", class: 'btn btn-xs btn-responsive btn-default') do
22
+ %span.glyphicon.glyphicon-pencil
23
+ %span.btn-text= t('.edit')
24
+ = link_to(resource, id: "#{id_base}-destroy", class: 'btn btn-xs btn-responsive btn-danger', method: :delete, data: { confirm: I18n.t('.confirmations.delete') }) do
25
+ %span.glyphicon.glyphicon-fire
26
+ %span.btn-text= t('.delete')
@@ -1,6 +1,7 @@
1
1
  = table.column :title, sort: true
2
2
  = table.column :body, sort: true
3
+ = table.column :asset_details_count
3
4
  = table.association :creator, label_method: ->(r) { r.try_all(*Itsf::Backend.resource_title_methods) }
4
5
  = table.association :updater, label_method: ->(r) { r.try_all(*Itsf::Backend.resource_title_methods) }
5
- = table.timestamps format: :short, sort: true
6
+ = table.timestamps sort: true
6
7
  = table.acts_as_published_actions
data/config/routes.rb CHANGED
@@ -2,6 +2,9 @@ Ecm::Blog::Backend::Engine.routes.draw do
2
2
  resources :posts do
3
3
  post :toggle_published, on: :member
4
4
  end
5
+ resources :asset_details do
6
+ post :reposition, on: :member
7
+ end
5
8
 
6
9
  root to: 'home#index'
7
10
  end
@@ -1,7 +1,7 @@
1
1
  module Ecm
2
2
  module Blog
3
3
  module Backend
4
- VERSION = "0.1.0".freeze
4
+ VERSION = "0.1.1".freeze
5
5
  end
6
6
  end
7
7
  end
@@ -2,11 +2,13 @@ Ecm::Blog::Backend.configure do |config|
2
2
  # Set the resources, that will be shown in the backend menu.
3
3
  #
4
4
  # Default: config.registered_controllers = -> {[
5
- # Ecm::Blog::Backend::PostsController
5
+ # Ecm::Blog::Backend::PostsController,
6
+ # Ecm::Blog::Backend::AssetDetailsController
6
7
  # ]}
7
8
  #
8
9
  config.registered_controllers = -> {[
9
- Ecm::Blog::Backend::PostsController
10
+ Ecm::Blog::Backend::PostsController,
11
+ Ecm::Blog::Backend::AssetDetailsController
10
12
  ]}
11
13
 
12
14
  # Set the services, that will be shown in the backend menu.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecm_blog_backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-10 00:00:00.000000000 Z
11
+ date: 2018-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -40,13 +40,16 @@ files:
40
40
  - app/assets/stylesheets/ecm/blog/backend/application.css
41
41
  - app/assets/stylesheets/ecm/blog/backend/application/dummy.css
42
42
  - app/assets/stylesheets/ecm_blog_backend.css
43
+ - app/controllers/ecm/blog/backend/asset_details_controller.rb
43
44
  - app/controllers/ecm/blog/backend/home_controller.rb
44
45
  - app/controllers/ecm/blog/backend/posts_controller.rb
45
46
  - app/helpers/ecm/blog/backend/application_helper.rb
46
47
  - app/policies/ecm/blog/backend/engine_policy.rb
47
48
  - app/policies/ecm/blog/post_policy.rb
49
+ - app/views/ecm/blog/backend/asset_details/_table.haml
48
50
  - app/views/ecm/blog/backend/posts/_form.haml
49
51
  - app/views/ecm/blog/backend/posts/_show.haml
52
+ - app/views/ecm/blog/backend/posts/_show_extras.haml
50
53
  - app/views/ecm/blog/backend/posts/_table.haml
51
54
  - app/views/layouts/ecm/blog/backend/application.html.erb
52
55
  - config/initializers/assets.rb