trestle-mobility 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ea74e7c4f517865a447984c1f812e5d670fac6ea36ffd2042677d187d2199269
4
+ data.tar.gz: 118ec2ec169c0e7466916496ccfb6774a1e5f45990d575dd1655956eb0690709
5
+ SHA512:
6
+ metadata.gz: 8172808f3a88c0303150814fb7e0df65eff2c75e332ba6b1defb4bd488cbe15d92379e5dbded7ec563d435e2fa28950c09c9386ed2bb8619a2ee30ff645c5352
7
+ data.tar.gz: 64f25a7533b02e041ae478d89ea519fc794b12893b587cf67a62607a068e9f73756f000e20fed7c666f4272496da932797b578c80ebc1ace6abf9c002e17c840
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ Gemfile.lock
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.2
7
+ before_install: gem install bundler -v 2.0.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in trestle-mobility.gemspec
4
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,55 @@
1
+ # Blue Oak Model License
2
+
3
+ Version 1.0.0
4
+
5
+ ## Purpose
6
+
7
+ This license gives everyone as much permission to work with
8
+ this software as possible, while protecting contributors
9
+ from liability.
10
+
11
+ ## Acceptance
12
+
13
+ In order to receive this license, you must agree to its
14
+ rules. The rules of this license are both obligations
15
+ under that agreement and conditions to your license.
16
+ You must not do anything with this software that triggers
17
+ a rule that you cannot or will not follow.
18
+
19
+ ## Copyright
20
+
21
+ Each contributor licenses you to do everything with this
22
+ software that would otherwise infringe that contributor's
23
+ copyright in it.
24
+
25
+ ## Notices
26
+
27
+ You must ensure that everyone who gets a copy of
28
+ any part of this software from you, with or without
29
+ changes, also gets the text of this license or a link to
30
+ <https://blueoakcouncil.org/license/1.0.0>.
31
+
32
+ ## Excuse
33
+
34
+ If anyone notifies you in writing that you have not
35
+ complied with [Notices](#notices), you can keep your
36
+ license by taking all practical steps to comply within 30
37
+ days after the notice. If you do not do so, your license
38
+ ends immediately.
39
+
40
+ ## Patent
41
+
42
+ Each contributor licenses you to do everything with this
43
+ software that would otherwise infringe any patent claims
44
+ they can license or become able to license.
45
+
46
+ ## Reliability
47
+
48
+ No contributor can revoke this license.
49
+
50
+ ## No Liability
51
+
52
+ ***As far as the law allows, this software comes as is,
53
+ without any warranty or condition, and no contributor
54
+ will be liable to anyone for any damages related to this
55
+ software or this license, under any kind of legal claim.***
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Trestle Mobility Integration (trestle-mobility)
2
+
3
+ > [Mobility](https://github.com/shioyama/mobility) integration plugin for the [Trestle admin framework](https://trestle.io)
4
+
5
+ [![Gem](https://img.shields.io/gem/v/trestle-mobility.svg)](https://rubygems.org/gems/trestle-mobility)
6
+
7
+ ## Features / problems
8
+
9
+ - [ ] Manage Mobility translations with a tabbed interface in trestle
10
+ - [ ] Supports Postgres container back-end
11
+ - [ ] Probably works with other back-ends but has not been tested
12
+
13
+ ## Usage
14
+
15
+ Trestle Mobility requires you to enable [Mobility's `locale_accessors` plugin](https://github.com/shioyama/mobility#getset) to be enabled.
16
+
17
+ Assuming you've setup your models with Mobility's `translates` directives, you can use the `mobility_text_field` and `mobility_text_area` field types:
18
+
19
+ ```ruby
20
+ Trestle.resource(:posts) do
21
+ form do |user|
22
+ mobility_text_field :title
23
+ mobility_text_field :subtitle
24
+ mobility_text_area :content
25
+ end
26
+ end
27
+ ```
28
+
29
+ ## Installation
30
+
31
+ These instructions assume you have a working Trestle application. To integrate trestle-mobility, first add it to your application's Gemfile:
32
+
33
+ ```ruby
34
+ gem 'trestle-mobility'
35
+ ```
36
+
37
+ Run `bundle install`, and then restart your Rails server.
38
+
39
+ ## License
40
+
41
+ The gem is available as open source under the terms of the [Blue Oak Model License](https://blueoakcouncil.org/license/1.0.0).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,19 @@
1
+ <div>
2
+ <ul class="nav nav-tabs" role="tablist">
3
+ <% locales.each.with_index do |locale, index| %>
4
+ <li role="presentation"<%= ' class=active' if index.zero? %>>
5
+ <a href="#<%= "#{field_name}_#{locale}" %>" aria-controls="<%= locale %>" role="tab" data-toggle="tab"><%= EmojiFlag.new(locale) %></a>
6
+ </li>
7
+ <% end %>
8
+ </ul>
9
+
10
+ <div class="main-content">
11
+ <div class="tab-content">
12
+ <% locales.each.with_index do |locale, index| %>
13
+ <div role="tabpanel" class="tab-pane<%= " active" if index.zero? %>" id="<%= "#{field_name}_#{locale}" %>">
14
+ <%= form.text_area "#{field_name}_#{locale}" %>
15
+ </div>
16
+ <% end %>
17
+ </div>
18
+ </div>
19
+ </div>
@@ -0,0 +1,19 @@
1
+ <div>
2
+ <ul class="nav nav-tabs" role="tablist">
3
+ <% locales.each.with_index do |locale, index| %>
4
+ <li role="presentation"<%= ' class=active' if index.zero? %>>
5
+ <a href="#<%= "#{field_name}_#{locale}" %>" aria-controls="<%= locale %>" role="tab" data-toggle="tab"><%= EmojiFlag.new(locale) %></a>
6
+ </li>
7
+ <% end %>
8
+ </ul>
9
+
10
+ <div class="main-content">
11
+ <div class="tab-content">
12
+ <% locales.each.with_index do |locale, index| %>
13
+ <div role="tabpanel" class="tab-pane<%= " active" if index.zero? %>" id="<%= "#{field_name}_#{locale}" %>">
14
+ <%= form.text_field "#{field_name}_#{locale}" %>
15
+ </div>
16
+ <% end %>
17
+ </div>
18
+ </div>
19
+ </div>
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "trestle/mobility"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,7 @@
1
+ require "trestle/mobility/text_area"
2
+ require "trestle/mobility/text_field"
3
+
4
+ Trestle.configure do |config|
5
+ config.form_field :mobility_text_area, Trestle::Mobility::TextArea
6
+ config.form_field :mobility_text_field, Trestle::Mobility::TextField
7
+ end
@@ -0,0 +1,6 @@
1
+ module Trestle
2
+ module Mobility
3
+ class Engine < Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,13 @@
1
+ module Trestle
2
+ module Mobility
3
+ class TextArea < Trestle::Form::Field
4
+ def field
5
+ instance = builder.object
6
+ locales = instance.translations.keys
7
+
8
+ @template.render partial: "trestle/mobility/text_area",
9
+ locals: { field_name: name, locales: locales }
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module Trestle
2
+ module Mobility
3
+ class TextField < Trestle::Form::Field
4
+ def field
5
+ instance = builder.object
6
+ locales = I18n.available_locales.sort
7
+
8
+ @template.render partial: "trestle/mobility/text_field",
9
+ locals: { field_name: name, locales: locales }
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module Trestle
2
+ module Mobility
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ require "emoji_flag"
2
+ require "trestle"
3
+ require "trestle/mobility/version"
4
+ require "trestle/mobility/engine" if defined?(Rails)
@@ -0,0 +1,31 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "trestle/mobility/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "trestle-mobility"
8
+ spec.version = Trestle::Mobility::VERSION
9
+ spec.authors = ["Richard Venneman"]
10
+ spec.email = ["richardvenneman@me.com"]
11
+ spec.license = "Blue Oak Model License"
12
+
13
+ spec.summary = %q{Mobility integration plugin for the Trestle admin framework}
14
+ spec.description = %q{Mobility integration plugin for the Trestle admin framework}
15
+ spec.homepage = "https://github.com/richardvenneman/trestle-mobility"
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_dependency "emoji_flag", "~> 0.1"
27
+
28
+ spec.add_development_dependency "bundler", "~> 2.0"
29
+ spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency "minitest", "~> 5.0"
31
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: trestle-mobility
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Richard Venneman
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-04-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: emoji_flag
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ description: Mobility integration plugin for the Trestle admin framework
70
+ email:
71
+ - richardvenneman@me.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".travis.yml"
78
+ - Gemfile
79
+ - LICENSE.md
80
+ - README.md
81
+ - Rakefile
82
+ - app/views/trestle/mobility/_text_area.html.erb
83
+ - app/views/trestle/mobility/_text_field.html.erb
84
+ - bin/console
85
+ - bin/setup
86
+ - config/initializers/trestle.rb
87
+ - lib/trestle/mobility.rb
88
+ - lib/trestle/mobility/engine.rb
89
+ - lib/trestle/mobility/text_area.rb
90
+ - lib/trestle/mobility/text_field.rb
91
+ - lib/trestle/mobility/version.rb
92
+ - trestle-mobility.gemspec
93
+ homepage: https://github.com/richardvenneman/trestle-mobility
94
+ licenses:
95
+ - Blue Oak Model License
96
+ metadata: {}
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubygems_version: 3.0.3
113
+ signing_key:
114
+ specification_version: 4
115
+ summary: Mobility integration plugin for the Trestle admin framework
116
+ test_files: []