biovision-testimonials 0.1.190607.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +22 -0
- data/app/assets/config/biovision_testimonials_manifest.js +0 -0
- data/app/controllers/admin/testimonials_controller.rb +29 -0
- data/app/controllers/testimonials_controller.rb +65 -0
- data/app/helpers/testimonials_helper.rb +11 -0
- data/app/models/testimonial.rb +54 -0
- data/app/services/biovision/components/testimonials_component.rb +9 -0
- data/app/views/admin/index/dashboard/_biovision_testimonials.html.erb +9 -0
- data/app/views/admin/testimonials/_nav_item.html.erb +2 -0
- data/app/views/admin/testimonials/entity/_in_list.html.erb +34 -0
- data/app/views/admin/testimonials/index.html.erb +22 -0
- data/app/views/admin/testimonials/show.html.erb +56 -0
- data/app/views/index/dashboard/_biovision_partners.html.erb +15 -0
- data/app/views/testimonials/_carousel.html.erb +17 -0
- data/app/views/testimonials/_form.html.erb +113 -0
- data/app/views/testimonials/_testimonial.html.erb +9 -0
- data/app/views/testimonials/edit.html.erb +17 -0
- data/app/views/testimonials/new.html.erb +15 -0
- data/config/locales/testimonials-ru.yml +57 -0
- data/config/routes.rb +25 -0
- data/db/migrate/20190606000000_create_testimonials.rb +43 -0
- data/lib/biovision/testimonials.rb +7 -0
- data/lib/biovision/testimonials/engine.rb +18 -0
- data/lib/biovision/testimonials/version.rb +7 -0
- data/lib/tasks/biovision/testimonials_tasks.rake +4 -0
- metadata +169 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 04dbe4182f37f95eae75007c80d99af7891f5d128c5c3e9cf929c3a964177744
|
4
|
+
data.tar.gz: 9f779904e931a94daf4ed890947eb60a0164400ff5e620d3d7329ffe10679636
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6d7ba86757d9a78e44d92deb19d0615af2e62c97c2b92d289858a32ee39ba44bec4366bfee4026663eec0269c7284ca276ff56e7680c361ed4a5981663363c88
|
7
|
+
data.tar.gz: 78a0a67991366788c625d1a59535dddf7f5293666090419b7b8dcf808cd203dc9283c8c549b1809bc08dbd76b745ce1f84fb0bc1737fa74243e3ff7428495c9d
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2019 Maxim Khan-Magomedov
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Biovision::Testimonials
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'biovision-testimonials'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install biovision-testimonials
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Biovision::Testimonials'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("spec/test_app/Rakefile", __dir__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
load 'rails/tasks/statistics.rake'
|
21
|
+
|
22
|
+
require 'bundler/gem_tasks'
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Administrative part of testimonials management
|
4
|
+
class Admin::TestimonialsController < AdminController
|
5
|
+
include EntityPriority
|
6
|
+
include ToggleableEntity
|
7
|
+
|
8
|
+
before_action :set_entity, except: :index
|
9
|
+
|
10
|
+
# get /admin/testimonials
|
11
|
+
def index
|
12
|
+
@collection = Testimonial.list_for_administration
|
13
|
+
end
|
14
|
+
|
15
|
+
# get /admin/testimonials/:id
|
16
|
+
def show
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def set_entity
|
22
|
+
@entity = Testimonial.find_by(id: params[:id])
|
23
|
+
handle_http_404('Cannot find testimonial') if @entity.nil?
|
24
|
+
end
|
25
|
+
|
26
|
+
def restrict_access
|
27
|
+
component_restriction Biovision::Components::TestimonialsComponent
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Handling testimonials
|
4
|
+
class TestimonialsController < AdminController
|
5
|
+
before_action :set_entity, only: %i[edit update destroy]
|
6
|
+
|
7
|
+
# post /testimonials/check
|
8
|
+
def check
|
9
|
+
@entity = Testimonial.instance_for_check(params[:entity_id], entity_parameters)
|
10
|
+
|
11
|
+
render 'shared/forms/check'
|
12
|
+
end
|
13
|
+
|
14
|
+
# get /testimonials/new
|
15
|
+
def new
|
16
|
+
@entity = Testimonial.new
|
17
|
+
end
|
18
|
+
|
19
|
+
# post /testimonials
|
20
|
+
def create
|
21
|
+
@entity = Testimonial.new(entity_parameters)
|
22
|
+
@entity.language = current_language
|
23
|
+
if @entity.save
|
24
|
+
form_processed_ok(admin_testimonial_path(id: @entity.id))
|
25
|
+
else
|
26
|
+
form_processed_with_error(:new)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# get /testimonials/:id/edit
|
31
|
+
def edit
|
32
|
+
end
|
33
|
+
|
34
|
+
# patch /testimonials/:id
|
35
|
+
def update
|
36
|
+
if @entity.update entity_parameters
|
37
|
+
form_processed_ok(admin_testimonial_path(id: @entity.id))
|
38
|
+
else
|
39
|
+
form_processed_with_error(:edit)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# delete /testimonials/:id
|
44
|
+
def destroy
|
45
|
+
flash[:notice] = t('testimonials.destroy.success') if @entity.destroy
|
46
|
+
|
47
|
+
redirect_to(admin_testimonials_path)
|
48
|
+
end
|
49
|
+
|
50
|
+
protected
|
51
|
+
|
52
|
+
def restrict_access
|
53
|
+
component_restriction Biovision::Components::TestimonialsComponent
|
54
|
+
end
|
55
|
+
|
56
|
+
def set_entity
|
57
|
+
@entity = Testimonial.find_by(id: params[:id])
|
58
|
+
|
59
|
+
handle_http_404('Cannot find testimonial') if @entity.nil?
|
60
|
+
end
|
61
|
+
|
62
|
+
def entity_parameters
|
63
|
+
params.require(:testimonial).permit(Testimonial.entity_parameters)
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Helper methods for handling testimonials
|
4
|
+
module TestimonialsHelper
|
5
|
+
# @param [Testimonial] entity
|
6
|
+
# @param [String] text
|
7
|
+
# @param [Hash] options
|
8
|
+
def admin_testimonial_link(entity, text = entity.name, options = {})
|
9
|
+
link_to(text, admin_testimonial_path(id: entity.id), options)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Testimonial
|
4
|
+
#
|
5
|
+
# Attributes:
|
6
|
+
# created_at [DateTime]
|
7
|
+
# data [jsonb]
|
8
|
+
# date [date]
|
9
|
+
# image [SimpleImageUploader], optional
|
10
|
+
# language_id [Language]
|
11
|
+
# name [string]
|
12
|
+
# priority [integer]
|
13
|
+
# text [text]
|
14
|
+
# url [string], optional
|
15
|
+
# updated_at [DateTime]
|
16
|
+
# visible [boolean]
|
17
|
+
class Testimonial < ApplicationRecord
|
18
|
+
include Checkable
|
19
|
+
include Toggleable
|
20
|
+
include FlatPriority
|
21
|
+
|
22
|
+
NAME_LIMIT = 100
|
23
|
+
TEXT_LIMIT = 5000
|
24
|
+
URL_LIMIT = 255
|
25
|
+
|
26
|
+
toggleable :visible
|
27
|
+
|
28
|
+
mount_uploader :image, SimpleImageUploader
|
29
|
+
|
30
|
+
belongs_to :language
|
31
|
+
|
32
|
+
after_initialize { self.date = Time.now.to_date if date.nil? }
|
33
|
+
|
34
|
+
validates_presence_of :date, :name, :text
|
35
|
+
validates_length_of :name, maximum: NAME_LIMIT
|
36
|
+
validates_length_of :url, maximum: URL_LIMIT
|
37
|
+
validates_length_of :text, maximum: TEXT_LIMIT
|
38
|
+
|
39
|
+
scope :visible, -> { where(visible: true) }
|
40
|
+
scope :for_language, ->(v) { where(language: v) }
|
41
|
+
scope :list_for_administration, -> { ordered_by_priority }
|
42
|
+
scope :list_for_visitors, -> { visible.ordered_by_priority }
|
43
|
+
|
44
|
+
def self.entity_parameters
|
45
|
+
%i[date image language_id name priority text url visible]
|
46
|
+
end
|
47
|
+
|
48
|
+
# @param [User] user
|
49
|
+
def editable_by?(user)
|
50
|
+
return false if user.nil?
|
51
|
+
|
52
|
+
Biovision::Components::TestimonialsComponent.allow?(user)
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<div class="image">
|
2
|
+
<%= simple_image_preview(entity) %>
|
3
|
+
</div>
|
4
|
+
<div class="data">
|
5
|
+
<div><%= admin_testimonial_link(entity) %></div>
|
6
|
+
<% unless entity.url.blank? %>
|
7
|
+
<div class="secondary info">
|
8
|
+
<%= entity.url %>
|
9
|
+
</div>
|
10
|
+
<% end %>
|
11
|
+
<div class="secondary info">
|
12
|
+
<%= time_tag(entity.date) %>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<%=
|
16
|
+
render(
|
17
|
+
partial: 'shared/admin/toggleable',
|
18
|
+
locals: {
|
19
|
+
entity: entity,
|
20
|
+
url: toggle_admin_testimonial_path(id: entity.id)
|
21
|
+
}
|
22
|
+
)
|
23
|
+
%>
|
24
|
+
|
25
|
+
<ul class="actions">
|
26
|
+
<li><%= edit_icon(edit_testimonial_path(id: entity.id)) %></li>
|
27
|
+
<%=
|
28
|
+
render(
|
29
|
+
partial: 'shared/actions/priority_changer',
|
30
|
+
locals: { path: priority_admin_testimonial_path(id: entity.id) }
|
31
|
+
)
|
32
|
+
%>
|
33
|
+
</ul>
|
34
|
+
</div>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<% content_for :meta_title, t('.title') %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<span><%= t('admin.testimonials.nav_item.text') %></span>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<article>
|
7
|
+
<h1><%= t('.heading') %></h1>
|
8
|
+
|
9
|
+
<ul class="actions">
|
10
|
+
<li><%= back_icon(admin_path) %></li>
|
11
|
+
<li><%= create_icon(new_testimonial_path) %></li>
|
12
|
+
</ul>
|
13
|
+
|
14
|
+
<%=
|
15
|
+
render(
|
16
|
+
partial: 'shared/admin/list_with_priority',
|
17
|
+
locals: {
|
18
|
+
collection: @collection
|
19
|
+
}
|
20
|
+
)
|
21
|
+
%>
|
22
|
+
</article>
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<% content_for :meta_title, t('.title', name: @entity.name) %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<%= link_to(t('admin.testimonials.nav_item.text'), admin_testimonials_path) %>
|
4
|
+
<span><%= @entity.name %></span>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<article>
|
8
|
+
<h1><%= @entity.name %></h1>
|
9
|
+
|
10
|
+
<ul class="actions">
|
11
|
+
<li><%= back_icon(admin_testimonials_path) %></li>
|
12
|
+
<li><%= edit_icon(edit_testimonial_path(id: @entity.id)) %></li>
|
13
|
+
</ul>
|
14
|
+
|
15
|
+
<dl>
|
16
|
+
<dt><%= t('activerecord.attributes.testimonial.priority') %></dt>
|
17
|
+
<dd><%= @entity.priority %></dd>
|
18
|
+
|
19
|
+
<% unless @entity.image.blank? %>
|
20
|
+
<dt><%= t('activerecord.attributes.testimonial.image') %></dt>
|
21
|
+
<dd>
|
22
|
+
<figure class="preview">
|
23
|
+
<%= simple_image_medium(@entity) %>
|
24
|
+
</figure>
|
25
|
+
</dd>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<dt><%= t('activerecord.attributes.testimonial.date') %></dt>
|
29
|
+
<dd><%= time_tag @entity.date %></dd>
|
30
|
+
|
31
|
+
<dt><%= t('activerecord.attributes.testimonial.name') %></dt>
|
32
|
+
<dd><%= @entity.name %></dd>
|
33
|
+
|
34
|
+
<% unless @entity.url.blank? %>
|
35
|
+
<dt><%= t('activerecord.attributes.testimonial.url') %></dt>
|
36
|
+
<dd><%= @entity.url %></dd>
|
37
|
+
<% end %>
|
38
|
+
|
39
|
+
<dt><%= t('activerecord.attributes.testimonial.text') %></dt>
|
40
|
+
<dd>
|
41
|
+
<div class="text">
|
42
|
+
<%= simple_format(@entity.text) %>
|
43
|
+
</div>
|
44
|
+
</dd>
|
45
|
+
</dl>
|
46
|
+
|
47
|
+
<%=
|
48
|
+
render(
|
49
|
+
partial: 'shared/admin/toggleable',
|
50
|
+
locals: {
|
51
|
+
entity: @entity,
|
52
|
+
url: toggle_admin_testimonial_path(id: @entity.id)
|
53
|
+
}
|
54
|
+
)
|
55
|
+
%>
|
56
|
+
</article>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% collection = Testimonial.list_for_visitors %>
|
2
|
+
<% if collection.load.any? %>
|
3
|
+
<section class="index-testimonials">
|
4
|
+
<h2><%= t('.heading') %></h2>
|
5
|
+
|
6
|
+
<%=
|
7
|
+
render(
|
8
|
+
partial: 'testimonials/carousel',
|
9
|
+
locals: {
|
10
|
+
collection: collection
|
11
|
+
}
|
12
|
+
)
|
13
|
+
%>
|
14
|
+
</section>
|
15
|
+
<% end %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%
|
2
|
+
collection ||= Testimonial.list_for_visitors
|
3
|
+
timeout ||= 3000
|
4
|
+
%>
|
5
|
+
<% if collection.any? %>
|
6
|
+
<div class="js-biovision-carousel testimonials-carousel" data-timeout="<%= timeout %>">
|
7
|
+
<button class="prev"></button>
|
8
|
+
<ul class="carousel-container">
|
9
|
+
<% collection.each do |entity| %>
|
10
|
+
<li class="carousel-item">
|
11
|
+
<%= render entity %>
|
12
|
+
</li>
|
13
|
+
<% end %>
|
14
|
+
</ul>
|
15
|
+
<button class="next"></button>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
@@ -0,0 +1,113 @@
|
|
1
|
+
<% model_name = entity.class.to_s.underscore %>
|
2
|
+
<%=
|
3
|
+
form_with(
|
4
|
+
model: entity,
|
5
|
+
html: {
|
6
|
+
id: "#{model_name}-form",
|
7
|
+
data: { check_url: check_testimonials_path }
|
8
|
+
}
|
9
|
+
) do |f|
|
10
|
+
%>
|
11
|
+
<%= render partial: 'shared/list_of_errors', locals: { entity: entity } %>
|
12
|
+
|
13
|
+
<dl>
|
14
|
+
<%= render partial: 'shared/forms/priority', locals: { f: f } %>
|
15
|
+
|
16
|
+
<dt><%= f.label :name %></dt>
|
17
|
+
<dd>
|
18
|
+
<%=
|
19
|
+
f.text_field(
|
20
|
+
:name,
|
21
|
+
id: "#{model_name}_name",
|
22
|
+
size: nil,
|
23
|
+
maxlength: Testimonial::NAME_LIMIT,
|
24
|
+
required: true,
|
25
|
+
data: {
|
26
|
+
check: :name
|
27
|
+
}
|
28
|
+
)
|
29
|
+
%>
|
30
|
+
<div class="check-result-error" data-field="name"></div>
|
31
|
+
<div class="guideline"><%= t('.guidelines.name') %></div>
|
32
|
+
</dd>
|
33
|
+
|
34
|
+
<dt><%= f.label :text %></dt>
|
35
|
+
<dd>
|
36
|
+
<%=
|
37
|
+
f.text_area(
|
38
|
+
:text,
|
39
|
+
id: "#{model_name}_text",
|
40
|
+
cols: 80,
|
41
|
+
rows: 3,
|
42
|
+
class: 'auto-expand',
|
43
|
+
data: {
|
44
|
+
check: :text,
|
45
|
+
min_rows: 3,
|
46
|
+
max_rows: 40
|
47
|
+
}
|
48
|
+
)
|
49
|
+
%>
|
50
|
+
<div class="check-result-error" data-field="text"></div>
|
51
|
+
<div class="guideline"><%= t('.guidelines.text') %></div>
|
52
|
+
</dd>
|
53
|
+
|
54
|
+
<!--
|
55
|
+
<dt><%= f.label :image %></dt>
|
56
|
+
<dd>
|
57
|
+
<% figure_id = "#{model_name}-image" %>
|
58
|
+
<figure role="group" class="preview" id="<%= figure_id %>">
|
59
|
+
<% if entity.image.blank? %>
|
60
|
+
<%= f.label :image, image_tag('biovision/base/placeholders/1x1.svg') %>
|
61
|
+
<% else %>
|
62
|
+
<%= f.label :image, image_tag(entity.image.medium_url) %>
|
63
|
+
<% end %>
|
64
|
+
<figcaption>
|
65
|
+
<%=
|
66
|
+
f.file_field(
|
67
|
+
:image,
|
68
|
+
id: "#{model_name}_image",
|
69
|
+
accept: 'image/jpeg,image/png,image/svg+xml',
|
70
|
+
data: { image: figure_id }
|
71
|
+
)
|
72
|
+
%>
|
73
|
+
</figcaption>
|
74
|
+
</figure>
|
75
|
+
<div class="guideline"><%= t('.guidelines.image') %></div>
|
76
|
+
</dd>
|
77
|
+
-->
|
78
|
+
<!--
|
79
|
+
<dt><%= f.label :url %></dt>
|
80
|
+
<dd>
|
81
|
+
<%=
|
82
|
+
f.url_field(
|
83
|
+
:url,
|
84
|
+
id: "#{model_name}_url",
|
85
|
+
size: nil,
|
86
|
+
maxlength: Testimonial::URL_LIMIT
|
87
|
+
)
|
88
|
+
%>
|
89
|
+
<div class="guideline"><%= t('.guidelines.url') %></div>
|
90
|
+
</dd>
|
91
|
+
-->
|
92
|
+
<dt><%= f.label :date %></dt>
|
93
|
+
<dd>
|
94
|
+
<%=
|
95
|
+
f.date_field(
|
96
|
+
:date,
|
97
|
+
id: "#{model_name}_date",
|
98
|
+
size: 10,
|
99
|
+
required: true
|
100
|
+
)
|
101
|
+
%>
|
102
|
+
</dd>
|
103
|
+
|
104
|
+
<%= render partial: 'shared/forms/entity_flags', locals: { f: f } %>
|
105
|
+
</dl>
|
106
|
+
|
107
|
+
<%= render 'shared/forms/state_container' %>
|
108
|
+
|
109
|
+
<div class="buttons">
|
110
|
+
<%= hidden_field_tag :entity_id, entity.id %>
|
111
|
+
<%= f.button t(:save), type: :submit, class: 'button-save' %>
|
112
|
+
</div>
|
113
|
+
<% end %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% content_for :meta_title, t('.title') %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<%= link_to(t('admin.partners.nav_item.text'), admin_partners_path) %>
|
4
|
+
<%= admin_partner_link(@entity) %>
|
5
|
+
<span><%= t('.nav_text') %></span>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<article>
|
9
|
+
<h1><%= t('.heading') %></h1>
|
10
|
+
|
11
|
+
<ul class="actions">
|
12
|
+
<li><%= return_icon(admin_partner_path(id: @entity.id)) %></li>
|
13
|
+
<li class="danger"><%= destroy_icon(@entity) %></li>
|
14
|
+
</ul>
|
15
|
+
|
16
|
+
<%= render partial: 'form', locals: { entity: @entity } %>
|
17
|
+
</article>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% content_for :meta_title, t('.title') %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<%= link_to(t('admin.partners.nav_item.text'), admin_partners_path) %>
|
4
|
+
<span><%= t('.nav_text') %></span>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<article>
|
8
|
+
<h1><%= t('.title') %></h1>
|
9
|
+
|
10
|
+
<ul class="actions">
|
11
|
+
<li><%= back_icon(admin_partners_path) %></li>
|
12
|
+
</ul>
|
13
|
+
|
14
|
+
<%= render partial: 'form', locals: { entity: @entity } %>
|
15
|
+
</article>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
ru:
|
2
|
+
activerecord:
|
3
|
+
models:
|
4
|
+
testimonial: "Отзыв"
|
5
|
+
attributes:
|
6
|
+
testimonial:
|
7
|
+
date: "Дата"
|
8
|
+
image: "Картинка"
|
9
|
+
language: "Язык"
|
10
|
+
language_id: "Язык"
|
11
|
+
name: "Имя"
|
12
|
+
priority: "Порядок сортировки"
|
13
|
+
text: "Текст"
|
14
|
+
url: "URL"
|
15
|
+
visible: "Показывать"
|
16
|
+
admin:
|
17
|
+
testimonials:
|
18
|
+
show:
|
19
|
+
title: "Отзывы: %{name}"
|
20
|
+
nav_item:
|
21
|
+
text: "Отзывы"
|
22
|
+
description: "Управление отзывами"
|
23
|
+
index:
|
24
|
+
heading: "Отзывы"
|
25
|
+
nav_text: "Отзывы"
|
26
|
+
title: "Отзывы"
|
27
|
+
index:
|
28
|
+
dashboard:
|
29
|
+
biovision_testimonials:
|
30
|
+
heading: "Отзывы"
|
31
|
+
biovision:
|
32
|
+
components:
|
33
|
+
testimonials:
|
34
|
+
name: "Отзывы"
|
35
|
+
testimonials:
|
36
|
+
new:
|
37
|
+
heading: "Добавить отзыв"
|
38
|
+
nav_text: "Создать"
|
39
|
+
title: "Добавление отзыва"
|
40
|
+
edit:
|
41
|
+
heading: "Редактирование отзыва"
|
42
|
+
nav_text: "Редактировать"
|
43
|
+
title: "Редактирование отзыва"
|
44
|
+
destroy:
|
45
|
+
success: "Отзыв удалён"
|
46
|
+
form:
|
47
|
+
guidelines:
|
48
|
+
image: "Картинка в формате JPG или PNG размером в пределах 1280×1280 для иллюстрации."
|
49
|
+
name: "Максимум 100 символов."
|
50
|
+
text: "Максимум 5000 символов."
|
51
|
+
url: "Ссылка на страницу клиента (социальная сеть и прочее). Максимум 255 символов."
|
52
|
+
update:
|
53
|
+
success: "Отзыв успешно отредактирован"
|
54
|
+
index:
|
55
|
+
dashboard:
|
56
|
+
biovision_partners:
|
57
|
+
heading: "Отзывы"
|
data/config/routes.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Rails.application.routes.draw do
|
4
|
+
concern :priority do
|
5
|
+
post :priority, on: :member, defaults: { format: :json }
|
6
|
+
end
|
7
|
+
|
8
|
+
concern :toggle do
|
9
|
+
post :toggle, on: :member, defaults: { format: :json }
|
10
|
+
end
|
11
|
+
|
12
|
+
concern :check do
|
13
|
+
post :check, on: :collection, defaults: { format: :json }
|
14
|
+
end
|
15
|
+
|
16
|
+
resources :testimonials, only: %i[update destroy]
|
17
|
+
|
18
|
+
scope '/(:locale)', constraints: { locale: /ru|en|sv|cn/ } do
|
19
|
+
resources :testimonials, only: %i[new create edit], concerns: :check
|
20
|
+
|
21
|
+
namespace :admin do
|
22
|
+
resources :testimonials, only: %i[index show], concerns: %i[toggle priority]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Create tables for testimonials component
|
4
|
+
class CreateTestimonials < ActiveRecord::Migration[5.2]
|
5
|
+
def up
|
6
|
+
create_testimonials unless Testimonial.table_exists?
|
7
|
+
create_component
|
8
|
+
create_privilege
|
9
|
+
end
|
10
|
+
|
11
|
+
def down
|
12
|
+
drop_table :testimonials if Testimonial.table_exists?
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def create_testimonials
|
18
|
+
create_table :testimonials, comment: 'Client testimonial' do |t|
|
19
|
+
t.references :language, null: false, foreign_key: { on_update: :cascade, on_delete: :cascade }
|
20
|
+
t.boolean :visible, default: true, null: false
|
21
|
+
t.integer :priority, limit: 2, default: 1, null: false
|
22
|
+
t.timestamps
|
23
|
+
t.date :date
|
24
|
+
t.string :name, null: false
|
25
|
+
t.string :image
|
26
|
+
t.string :url
|
27
|
+
t.text :text, null: false
|
28
|
+
t.jsonb :data, default: {}, null: false
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def create_component
|
33
|
+
BiovisionComponent.create(slug: :testimonials)
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_privilege
|
37
|
+
Privilege.create(
|
38
|
+
slug: 'testimonials_manager',
|
39
|
+
name: 'Управляющий отзывами',
|
40
|
+
administrative: true
|
41
|
+
)
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Biovision
|
4
|
+
module Testimonials
|
5
|
+
require 'biovision/base'
|
6
|
+
|
7
|
+
class Engine < ::Rails::Engine
|
8
|
+
config.generators do |g|
|
9
|
+
g.test_framework :rspec
|
10
|
+
g.fixture_replacement :factory_bot, :dir => 'spec/factories'
|
11
|
+
end
|
12
|
+
|
13
|
+
initializer 'sample_engine.factories', after: 'factory_bot.set_factory_paths' do
|
14
|
+
FactoryBot.definition_file_paths << File.expand_path('../../../spec/factories', __FILE__) if defined?(FactoryBot)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: biovision-testimonials
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.190607.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Maxim Khan-Magomedov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-06-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 5.2.3
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 5.2.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails-i18n
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: biovision-base
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: database_cleaner
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: factory_bot_rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pg
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec-rails
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Testimonials component for biovision-based applications
|
112
|
+
email:
|
113
|
+
- maxim.km@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- MIT-LICENSE
|
119
|
+
- README.md
|
120
|
+
- Rakefile
|
121
|
+
- app/assets/config/biovision_testimonials_manifest.js
|
122
|
+
- app/controllers/admin/testimonials_controller.rb
|
123
|
+
- app/controllers/testimonials_controller.rb
|
124
|
+
- app/helpers/testimonials_helper.rb
|
125
|
+
- app/models/testimonial.rb
|
126
|
+
- app/services/biovision/components/testimonials_component.rb
|
127
|
+
- app/views/admin/index/dashboard/_biovision_testimonials.html.erb
|
128
|
+
- app/views/admin/testimonials/_nav_item.html.erb
|
129
|
+
- app/views/admin/testimonials/entity/_in_list.html.erb
|
130
|
+
- app/views/admin/testimonials/index.html.erb
|
131
|
+
- app/views/admin/testimonials/show.html.erb
|
132
|
+
- app/views/index/dashboard/_biovision_partners.html.erb
|
133
|
+
- app/views/testimonials/_carousel.html.erb
|
134
|
+
- app/views/testimonials/_form.html.erb
|
135
|
+
- app/views/testimonials/_testimonial.html.erb
|
136
|
+
- app/views/testimonials/edit.html.erb
|
137
|
+
- app/views/testimonials/new.html.erb
|
138
|
+
- config/locales/testimonials-ru.yml
|
139
|
+
- config/routes.rb
|
140
|
+
- db/migrate/20190606000000_create_testimonials.rb
|
141
|
+
- lib/biovision/testimonials.rb
|
142
|
+
- lib/biovision/testimonials/engine.rb
|
143
|
+
- lib/biovision/testimonials/version.rb
|
144
|
+
- lib/tasks/biovision/testimonials_tasks.rake
|
145
|
+
homepage: https://github.com/Biovision/biovision-testimonials
|
146
|
+
licenses:
|
147
|
+
- MIT
|
148
|
+
metadata:
|
149
|
+
allowed_push_host: https://rubygems.org
|
150
|
+
post_install_message:
|
151
|
+
rdoc_options: []
|
152
|
+
require_paths:
|
153
|
+
- lib
|
154
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
requirements: []
|
165
|
+
rubygems_version: 3.0.3
|
166
|
+
signing_key:
|
167
|
+
specification_version: 4
|
168
|
+
summary: Testimonials component for biovision-based applications
|
169
|
+
test_files: []
|