bamboo_legals 0.0.4 → 0.0.9
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 +4 -4
- data/bin/add_bamboo_legals +6 -1
- data/lib/bamboo_legals.rb +36 -0
- data/{bamboo_legals_lib → lib}/generators/controller.rb +0 -0
- data/{bamboo_legals_lib → lib}/generators/manual.rb +0 -0
- data/{bamboo_legals_lib → lib}/generators/migration.rb +0 -0
- data/{bamboo_legals_lib → lib}/generators/model.rb +0 -0
- data/{bamboo_legals_lib → lib}/generators/routes.rb +0 -0
- data/{bamboo_legals_lib → lib}/generators/views.rb +0 -0
- data/lib/templates/monolingual/admin_legals_controller.txt +51 -0
- data/lib/templates/monolingual/admin_views/_form.txt +33 -0
- data/lib/templates/monolingual/admin_views/_legal.txt +15 -0
- data/lib/templates/monolingual/admin_views/edit.txt +15 -0
- data/lib/templates/monolingual/admin_views/index.txt +31 -0
- data/lib/templates/monolingual/admin_views/new.txt +15 -0
- data/lib/templates/monolingual/legal.txt +26 -0
- data/lib/templates/monolingual/legals_controller.txt +5 -0
- data/lib/templates/monolingual/views/_index.txt +7 -0
- data/lib/templates/monolingual/views/show.txt +12 -0
- data/lib/templates/multilingual/admin_legals_controller.txt +56 -0
- data/lib/templates/multilingual/admin_views/_form.txt +43 -0
- data/lib/templates/multilingual/admin_views/edit.txt +13 -0
- data/lib/templates/multilingual/admin_views/index.txt +43 -0
- data/lib/templates/multilingual/admin_views/new.txt +13 -0
- data/lib/templates/multilingual/legal.txt +32 -0
- data/lib/templates/multilingual/legal_translation.txt +18 -0
- data/lib/templates/multilingual/legals_controller.txt +5 -0
- data/lib/templates/multilingual/views/_footer_legal.txt +6 -0
- data/lib/templates/multilingual/views/show.html.txt +17 -0
- metadata +29 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 32f367f4baa9c94da726208800af3edb1fd80fc5
|
|
4
|
+
data.tar.gz: 69d8fe5a9f4a406fa41dfc6b6fe4150fcdb36f13
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5ce7275746b8b060f75b3fd345fbd7ee5ea1f130242223cc5e51fca8b9d7eb941dbd7c4bf1b3ade232c15deb9079242e1e1084ff1c1ecf9899c3f25c87960848
|
|
7
|
+
data.tar.gz: 044cb96d76b8a56d5a3ac516f8542a0ec8909f5cbdb63734e4e87cf927c6db7e5bf064d23b3f8bfc677f1dd82e5422f36e9dadb22721fc17b24c9a8d7d303a3a
|
data/bin/add_bamboo_legals
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
unless File.exist?('./Rakefile') || File.exist?('./Gemfile')
|
|
4
|
+
abort 'Please run annotate from the root of the project.'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
require_relative '../lib/bamboo_legals'
|
|
3
8
|
|
|
4
9
|
get_type = ARGV[0] || "monolingual"
|
|
5
10
|
run_generator(get_type)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require 'fileutils'
|
|
2
|
+
|
|
3
|
+
require_relative 'generators/migration'
|
|
4
|
+
require_relative 'generators/model'
|
|
5
|
+
require_relative 'generators/controller'
|
|
6
|
+
require_relative 'generators/views'
|
|
7
|
+
require_relative 'generators/routes'
|
|
8
|
+
require_relative 'generators/manual'
|
|
9
|
+
|
|
10
|
+
def run_generator(get_type)
|
|
11
|
+
if get_type == "monolingual" or get_type == "mono"
|
|
12
|
+
type = "monolingual"
|
|
13
|
+
|
|
14
|
+
`rails g model Legal title:string content:text is_visible:boolean position:integer`
|
|
15
|
+
elsif get_type == "multilingual" or get_type == "multi"
|
|
16
|
+
type = "multilingual"
|
|
17
|
+
|
|
18
|
+
`rails g model Legal is_visible:boolean position:integer`
|
|
19
|
+
`rails g model LegalTranslation title:string content:text language_id:string position:integer legal_id:integer`
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
if type
|
|
23
|
+
overwrite_migration
|
|
24
|
+
overwrite_model(type)
|
|
25
|
+
|
|
26
|
+
create_admin_controller(type)
|
|
27
|
+
create_controller(type)
|
|
28
|
+
create_admin_views(type)
|
|
29
|
+
create_views(type)
|
|
30
|
+
|
|
31
|
+
overwrite_routes
|
|
32
|
+
print_manual(type)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
class Admin::LegalsController < Admin::BaseController
|
|
2
|
+
before_action :set_legal, only: [:edit, :update, :destroy]
|
|
3
|
+
|
|
4
|
+
def index
|
|
5
|
+
@legals = Legal.all
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def new
|
|
9
|
+
@legal = Legal.new
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def edit
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def create
|
|
16
|
+
@legal = Legal.new(legal_params)
|
|
17
|
+
if @legal.save
|
|
18
|
+
redirect_to admin_legals_path, notice: t('saved_successfully')
|
|
19
|
+
else
|
|
20
|
+
render :new
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def update
|
|
25
|
+
if @legal.update(legal_params)
|
|
26
|
+
redirect_to admin_legals_path, notice: t('saved_successfully')
|
|
27
|
+
else
|
|
28
|
+
render :edit
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def destroy
|
|
33
|
+
redirect_to admin_legals_path, alert: t('deleted_successfully')
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def sort
|
|
37
|
+
params[:legal].each_with_index do |id, index|
|
|
38
|
+
Legal.where(id: id).update_all(position: index + 1)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
|
|
44
|
+
def set_legal
|
|
45
|
+
@legal = Legal.find{ |t| t.title.parameterize == params[:id]}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def legal_params
|
|
49
|
+
params.require(:legal).permit(:title, :content, :is_visible)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<%= form_for [:admin, @legal], url: (@legal.new_record? ? admin_legals_path : admin_legal_path(id: @legal)), :html => {role: 'form', class: 'form'} do |f| %>
|
|
2
|
+
<fieldset class="form__fieldset">
|
|
3
|
+
<%=render partial: 'layouts/error_messages', as: :object, object: @legal %>
|
|
4
|
+
</fieldset>
|
|
5
|
+
|
|
6
|
+
<fieldset class="form__fieldset">
|
|
7
|
+
<div class="form__field">
|
|
8
|
+
<%= f.label :title, class: 'label' %>
|
|
9
|
+
<%= f.text_field :title, class: 'input' %>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<div class="form__field">
|
|
13
|
+
<%= f.label :content, class: 'label' %>
|
|
14
|
+
<%= f.text_area :content, class: 'input tinymce' %>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<div class="form__field input__field--text">
|
|
18
|
+
<%= f.check_box :is_visible, class: "input" %>
|
|
19
|
+
<%= f.label :is_visible, class: 'label' %>
|
|
20
|
+
</div>
|
|
21
|
+
</fieldset>
|
|
22
|
+
<fieldset class="form__fieldset">
|
|
23
|
+
<div class="field">
|
|
24
|
+
<%=f.submit t('save'), class: 'btn btn--full', data: {disable_with: '...'} %>
|
|
25
|
+
</div>
|
|
26
|
+
</fieldset>
|
|
27
|
+
<% end %>
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
$(document).ready(function(){
|
|
31
|
+
load_tiny();
|
|
32
|
+
});
|
|
33
|
+
</script>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<tr id=<%= dom_id(legal) %> class="table__item--wrap">
|
|
2
|
+
<td class="table__item col col--1"> <%#= image_tag("icons/dragndrop.png", height: '32', width: '32') %> </td>
|
|
3
|
+
<td class="table__item col col--1"><%= legal.title %></td>
|
|
4
|
+
<td class="table__item col col--1"><%= raw(legal.is_visible ? "✔" : "✖") %></td>
|
|
5
|
+
<td class="table__item col col--1" data-sort="<%= legal.created_at.strftime("%Y%m%d") %>"><%= legal.created_at.strftime("%d.%m.%Y.") %></td>
|
|
6
|
+
<td class="table__item table__icon--wrap col col--1">
|
|
7
|
+
<%= link_to edit_admin_legal_path(legal), class: "table__icon", "data-tooltip" => t('edit_tooltip') do %>
|
|
8
|
+
<%= inline_svg "icons/pen-group-3.svg" %>
|
|
9
|
+
<% end %>
|
|
10
|
+
|
|
11
|
+
<%= link_to [:admin, legal], method: :delete, data: { confirm: t('delete_confirm') }, class: "table__icon", "data-tooltip" => t('delete_tooltip') do %>
|
|
12
|
+
<%= inline_svg "icons/trash-simple.svg" %>
|
|
13
|
+
<% end %>
|
|
14
|
+
</td>
|
|
15
|
+
</tr>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<header class="header header--small">
|
|
2
|
+
<%= link_to admin_legals_path, class: "btn btn--back" do %>
|
|
3
|
+
<div class="arrow--left"></div>
|
|
4
|
+
<% end %>
|
|
5
|
+
|
|
6
|
+
<div class="header__content">
|
|
7
|
+
<h1><%= t('admin_nav.legals') %></h1>
|
|
8
|
+
<span class="main__subtitle"><%= t('edit') %></span>
|
|
9
|
+
</div>
|
|
10
|
+
</header>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<section class="section section--padded section--8">
|
|
14
|
+
<%= render 'form' %>
|
|
15
|
+
</section>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<header class="header header--double">
|
|
2
|
+
<h1><%= t('admin_nav.legal') %></h1>
|
|
3
|
+
<%= link_to t('create'), new_admin_legal_path, class: "btn btn--primary btn--large" %>
|
|
4
|
+
</header>
|
|
5
|
+
|
|
6
|
+
<section class="section section--12 section--double">
|
|
7
|
+
|
|
8
|
+
<table class="datatable table__icon--4">
|
|
9
|
+
<thead>
|
|
10
|
+
<tr class="table__head--wrap">
|
|
11
|
+
<td class="table__item col col--1"> </td>
|
|
12
|
+
<th class="table__head col col--1"><%= t('activerecord.attributes.legal.title') %></th>
|
|
13
|
+
<th class="table__head col col--1"><%= t('activerecord.attributes.legal.is_visible') %> </th>
|
|
14
|
+
<th class="table__head col col--1"><%= t('activerecord.attributes.legal.created_at') %> </th>
|
|
15
|
+
<th class="table__head col col--1"><%= t('actions') %></th>
|
|
16
|
+
</tr>
|
|
17
|
+
</thead>
|
|
18
|
+
|
|
19
|
+
<tbody class="sortable" data-url='<%=sort_admin_legals_path %>' >
|
|
20
|
+
<% @legals.each do |legal| %>
|
|
21
|
+
<%= render "legal", legal: legal %>
|
|
22
|
+
<% end %>
|
|
23
|
+
</tbody>
|
|
24
|
+
</table>
|
|
25
|
+
</section>
|
|
26
|
+
|
|
27
|
+
<script>
|
|
28
|
+
$(function(){
|
|
29
|
+
// init_datatable("<%= I18n.locale %>");
|
|
30
|
+
})
|
|
31
|
+
</script>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<header class="header header--small">
|
|
2
|
+
<%= link_to admin_legals_path, class: "btn btn--back" do %>
|
|
3
|
+
<div class="arrow--left"></div>
|
|
4
|
+
<% end %>
|
|
5
|
+
|
|
6
|
+
<div class="header__content">
|
|
7
|
+
<h1><%= t('admin_nav.legals') %></h1>
|
|
8
|
+
<span class="main__subtitle"><%= t('new') %></span>
|
|
9
|
+
</div>
|
|
10
|
+
</header>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<section class="section section--padded section--8">
|
|
14
|
+
<%= render 'form' %>
|
|
15
|
+
</section>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# == Schema Information
|
|
2
|
+
#
|
|
3
|
+
# Table name: legals
|
|
4
|
+
#
|
|
5
|
+
# id :bigint not null, primary key
|
|
6
|
+
# title :string
|
|
7
|
+
# content :text
|
|
8
|
+
# position :integer
|
|
9
|
+
# is_visible :boolean default("true")
|
|
10
|
+
# created_at :datetime not null
|
|
11
|
+
# updated_at :datetime not null
|
|
12
|
+
#
|
|
13
|
+
class Legal < ApplicationRecord
|
|
14
|
+
include LogActions
|
|
15
|
+
default_scope { order(:position) }
|
|
16
|
+
validates_presence_of :title, :content
|
|
17
|
+
|
|
18
|
+
def self.all_visible
|
|
19
|
+
where(is_visible: true)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def to_param
|
|
23
|
+
"#{self.title.parameterize}"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!-- SEO -->
|
|
2
|
+
<% content_for :title, "#{@legal.title}" %>
|
|
3
|
+
<% content_for :description, truncate(strip_tags(@legal.content), length: 160 ) %>
|
|
4
|
+
|
|
5
|
+
<div class="layout--main">
|
|
6
|
+
<div class="section">
|
|
7
|
+
<h1><%= @legal.title %></h1>
|
|
8
|
+
</div>
|
|
9
|
+
<article class="article">
|
|
10
|
+
<%= raw @legal.content %>
|
|
11
|
+
</article>
|
|
12
|
+
</div>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
class Admin::LegalsController < Admin::BaseController
|
|
2
|
+
before_action :set_legal, only: [:show, :edit, :update, :destroy]
|
|
3
|
+
|
|
4
|
+
def index
|
|
5
|
+
@legals = Legal.all
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def new
|
|
9
|
+
@legal = Legal.new
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def create
|
|
13
|
+
@legal = Legal.new(legal_params)
|
|
14
|
+
|
|
15
|
+
if @legal.save
|
|
16
|
+
redirect_to admin_legals_path, notice: t('saved_successfully')
|
|
17
|
+
else
|
|
18
|
+
render :new
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def edit
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def update
|
|
26
|
+
if @legal.update(legal_params)
|
|
27
|
+
redirect_to admin_legals_path, notice: t('saved_successfully')
|
|
28
|
+
else
|
|
29
|
+
render :edit
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def destroy
|
|
34
|
+
if @legal.destroy
|
|
35
|
+
redirect_to admin_legals_path, notice: t('deleted')
|
|
36
|
+
else
|
|
37
|
+
redirect_to admin_legals_path, alert: t('not_deleted')
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def sort
|
|
42
|
+
params[:legal].each_with_index do |id, index|
|
|
43
|
+
Legal.where(id: id).update_all(position: index + 1)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def set_legal
|
|
50
|
+
@legal = LegalTranslation.find{|t| t.title.parameterize == params[:id]}.legal
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def legal_params
|
|
54
|
+
params.require(:legal).permit(:is_visible, legal_translations_attributes: [:id, :title, :content, :language_id, :position, :keywords])
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<%= form_for [:admin, @legal], url: (@legal.new_record? ? admin_legals_path : admin_legal_path(id: @legal)), :html => {role: 'form', class: 'form'} do |f| %>
|
|
2
|
+
<fieldset class="form__fieldset">
|
|
3
|
+
<%=render partial: 'layouts/error_messages', as: :object, object: @legal %>
|
|
4
|
+
</fieldset>
|
|
5
|
+
|
|
6
|
+
<fieldset class="form__fieldset">
|
|
7
|
+
<div class="form__field">
|
|
8
|
+
<%= f.fields_for :legal_translations do |ff| %>
|
|
9
|
+
<%= language_title(ff) %>
|
|
10
|
+
|
|
11
|
+
<div class="form__field">
|
|
12
|
+
<%= ff.label :title, class: 'label' %>
|
|
13
|
+
<%= ff.text_field :title, class: 'input' %>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="form__field">
|
|
17
|
+
<%= ff.label :content, class: 'label' %>
|
|
18
|
+
<%= ff.text_area :content, class: 'input tinymce' %>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<%= ff.hidden_field :language_id, value: language_value(ff) %>
|
|
22
|
+
<%= ff.hidden_field :position, value: ff.options[:child_index] %>
|
|
23
|
+
<% end %>
|
|
24
|
+
|
|
25
|
+
<div class="form__field input__field--text">
|
|
26
|
+
<%= f.label :is_visible, class: 'label' %>
|
|
27
|
+
<%= f.check_box :is_visible, class: 'input' %>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
</fieldset>
|
|
31
|
+
|
|
32
|
+
<fieldset class="form__fieldset">
|
|
33
|
+
<div class="field">
|
|
34
|
+
<%=f.submit t('save'), class: 'btn btn--full', data: {disable_with: '...'} %>
|
|
35
|
+
</div>
|
|
36
|
+
</fieldset>
|
|
37
|
+
<% end %>
|
|
38
|
+
|
|
39
|
+
<script>
|
|
40
|
+
$(document).ready(function(){
|
|
41
|
+
load_tiny("hr");
|
|
42
|
+
});
|
|
43
|
+
</script>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<header class="header header--small">
|
|
2
|
+
<%= link_to admin_legals_path, class: "btn btn--back" do %>
|
|
3
|
+
<div class="arrow--left"></div>
|
|
4
|
+
<% end %>
|
|
5
|
+
|
|
6
|
+
<div class="header__content">
|
|
7
|
+
<h1><%= t('admin_nav.legals') %></h1>
|
|
8
|
+
</div>
|
|
9
|
+
</header>
|
|
10
|
+
|
|
11
|
+
<div class="section section--padded section__wrap--8 js_part">
|
|
12
|
+
<%= render 'form' %>
|
|
13
|
+
</div>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<header class="header header--double">
|
|
2
|
+
<h1><%= t('admin_nav.legals') %></h1>
|
|
3
|
+
<%= link_to t('create'), new_admin_legal_path, class: "btn btn--primary btn--large" %>
|
|
4
|
+
</header>
|
|
5
|
+
|
|
6
|
+
<section class="section section--12 section--double">
|
|
7
|
+
|
|
8
|
+
<table class="datatable custom-table table__icon--4">
|
|
9
|
+
<thead>
|
|
10
|
+
<tr class="table__head--wrap">
|
|
11
|
+
<th class="table__head col col--1"> <%= t('drag_and_drop') %> </th>
|
|
12
|
+
<th class="table__head col col--1"><%= t('activerecord.attributes.legal_translation.title') %></th>
|
|
13
|
+
<th class="table__head col col--1"><%= t('activerecord.attributes.legal.created_at') %> </th>
|
|
14
|
+
<th class="table__head col col--1"><%= t('actions') %></th>
|
|
15
|
+
</tr>
|
|
16
|
+
</thead>
|
|
17
|
+
|
|
18
|
+
<tbody class="sortable" data-url='<%=sort_admin_legals_path %>' >
|
|
19
|
+
<% @legals.each do |legal| %>
|
|
20
|
+
<tr id=<%= dom_id(legal) %> class="table__item--wrap">
|
|
21
|
+
<td class="table__item col col--1"> <%#= image_tag("icons/dragndrop.png", height: '32', width: '32') %> </td>
|
|
22
|
+
<td class="table__item col col--1"><%= legal.translate.title %></td>
|
|
23
|
+
<td class="table__item col col--1" data-sort="<%= legal.created_at.strftime("%Y%m%d") %>"><%= legal.created_at.strftime("%d.%m.%Y.") %></td>
|
|
24
|
+
<td class="table__item table__icon--wrap col col--1">
|
|
25
|
+
<%= link_to edit_admin_legal_path(legal), class: "table__icon" do %>
|
|
26
|
+
<%= inline_svg "icons/pen-group-3.svg" %>
|
|
27
|
+
<% end %>
|
|
28
|
+
|
|
29
|
+
<%= link_to [:admin, legal], method: :delete, data: { confirm: t('delete_confirm') }, class: "table__icon" do %>
|
|
30
|
+
<%= inline_svg "icons/trash-simple.svg" %>
|
|
31
|
+
<% end %>
|
|
32
|
+
</td>
|
|
33
|
+
</tr>
|
|
34
|
+
<% end %>
|
|
35
|
+
</tbody>
|
|
36
|
+
</table>
|
|
37
|
+
</section>
|
|
38
|
+
|
|
39
|
+
<script>
|
|
40
|
+
$(function(){
|
|
41
|
+
// init_datatable("<%= I18n.locale %>");
|
|
42
|
+
})
|
|
43
|
+
</script>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<header class="header header--small">
|
|
2
|
+
<%= link_to admin_legals_path, class: "btn btn--back" do %>
|
|
3
|
+
<div class="arrow--left"></div>
|
|
4
|
+
<% end %>
|
|
5
|
+
|
|
6
|
+
<div class="header__content">
|
|
7
|
+
<h1><%= t('admin_nav.legals') %></h1>
|
|
8
|
+
</div>
|
|
9
|
+
</header>
|
|
10
|
+
|
|
11
|
+
<div class="section section--padded section__wrap--8 js_part">
|
|
12
|
+
<%= render 'form' %>
|
|
13
|
+
</div>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# == Schema Information
|
|
2
|
+
#
|
|
3
|
+
# Table name: legals
|
|
4
|
+
#
|
|
5
|
+
# id :bigint not null, primary key
|
|
6
|
+
# position :integer
|
|
7
|
+
# is_visible :boolean default("true")
|
|
8
|
+
# created_at :datetime not null
|
|
9
|
+
# updated_at :datetime not null
|
|
10
|
+
#
|
|
11
|
+
class Legal < ApplicationRecord
|
|
12
|
+
include LogActions
|
|
13
|
+
|
|
14
|
+
has_many :legal_translations, dependent: :destroy
|
|
15
|
+
accepts_nested_attributes_for :legal_translations
|
|
16
|
+
|
|
17
|
+
include TranslationsInitializer
|
|
18
|
+
def to_param
|
|
19
|
+
"#{self.legal_translations.find_by(language_id: I18n.locale).title.parameterize}"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def translate(language_id=I18n.locale.to_s)
|
|
23
|
+
# commented code can be to added to app/models/concerns/translation_initializer.rb
|
|
24
|
+
# so other models can use it
|
|
25
|
+
#def translate(language_id=I18n.locale.to_s)
|
|
26
|
+
# translations = eval("#{self.model_name.param_key}_translations")
|
|
27
|
+
# translations.find_by(language_id: language_id)
|
|
28
|
+
#end
|
|
29
|
+
|
|
30
|
+
legal_translations.find_by(language_id: language_id)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# == Schema Information
|
|
2
|
+
#
|
|
3
|
+
# Table name: legal_translations
|
|
4
|
+
#
|
|
5
|
+
# id :bigint not null, primary key
|
|
6
|
+
# title :string
|
|
7
|
+
# content :text
|
|
8
|
+
# legal_id :integer
|
|
9
|
+
# language_id :string
|
|
10
|
+
# position :integer
|
|
11
|
+
# keywords :string
|
|
12
|
+
# created_at :datetime not null
|
|
13
|
+
# updated_at :datetime not null
|
|
14
|
+
#
|
|
15
|
+
class LegalTranslation < ApplicationRecord
|
|
16
|
+
belongs_to :legal
|
|
17
|
+
default_scope { order(:position) }
|
|
18
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- SEO -->
|
|
2
|
+
<% content_for :title, "#{@legal.translate.title}" %>
|
|
3
|
+
<% content_for :description, truncate(strip_tags(@legal.translate.content), length: 160 ) %>
|
|
4
|
+
|
|
5
|
+
<div class="layout--full">
|
|
6
|
+
<div class="layout--main">
|
|
7
|
+
<div class="text--center">
|
|
8
|
+
|
|
9
|
+
<h2><%= @legal.translate.title %></h2>
|
|
10
|
+
|
|
11
|
+
<div class="post__text">
|
|
12
|
+
<%= raw @legal.translate.content %>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bamboo_legals
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mislav Kvesić
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-09-
|
|
11
|
+
date: 2020-09-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: It should generate monolingual and multilingual legals for big_bamboom
|
|
14
14
|
email: kvesic.mislav@gmail.com
|
|
@@ -17,13 +17,34 @@ executables:
|
|
|
17
17
|
extensions: []
|
|
18
18
|
extra_rdoc_files: []
|
|
19
19
|
files:
|
|
20
|
-
- bamboo_legals_lib/generators/controller.rb
|
|
21
|
-
- bamboo_legals_lib/generators/manual.rb
|
|
22
|
-
- bamboo_legals_lib/generators/migration.rb
|
|
23
|
-
- bamboo_legals_lib/generators/model.rb
|
|
24
|
-
- bamboo_legals_lib/generators/routes.rb
|
|
25
|
-
- bamboo_legals_lib/generators/views.rb
|
|
26
20
|
- bin/add_bamboo_legals
|
|
21
|
+
- lib/bamboo_legals.rb
|
|
22
|
+
- lib/generators/controller.rb
|
|
23
|
+
- lib/generators/manual.rb
|
|
24
|
+
- lib/generators/migration.rb
|
|
25
|
+
- lib/generators/model.rb
|
|
26
|
+
- lib/generators/routes.rb
|
|
27
|
+
- lib/generators/views.rb
|
|
28
|
+
- lib/templates/monolingual/admin_legals_controller.txt
|
|
29
|
+
- lib/templates/monolingual/admin_views/_form.txt
|
|
30
|
+
- lib/templates/monolingual/admin_views/_legal.txt
|
|
31
|
+
- lib/templates/monolingual/admin_views/edit.txt
|
|
32
|
+
- lib/templates/monolingual/admin_views/index.txt
|
|
33
|
+
- lib/templates/monolingual/admin_views/new.txt
|
|
34
|
+
- lib/templates/monolingual/legal.txt
|
|
35
|
+
- lib/templates/monolingual/legals_controller.txt
|
|
36
|
+
- lib/templates/monolingual/views/_index.txt
|
|
37
|
+
- lib/templates/monolingual/views/show.txt
|
|
38
|
+
- lib/templates/multilingual/admin_legals_controller.txt
|
|
39
|
+
- lib/templates/multilingual/admin_views/_form.txt
|
|
40
|
+
- lib/templates/multilingual/admin_views/edit.txt
|
|
41
|
+
- lib/templates/multilingual/admin_views/index.txt
|
|
42
|
+
- lib/templates/multilingual/admin_views/new.txt
|
|
43
|
+
- lib/templates/multilingual/legal.txt
|
|
44
|
+
- lib/templates/multilingual/legal_translation.txt
|
|
45
|
+
- lib/templates/multilingual/legals_controller.txt
|
|
46
|
+
- lib/templates/multilingual/views/_footer_legal.txt
|
|
47
|
+
- lib/templates/multilingual/views/show.html.txt
|
|
27
48
|
homepage: https://rubygems.org/gems/bamboo_legals
|
|
28
49
|
licenses:
|
|
29
50
|
- MIT
|