templates-rails 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
  SHA256:
3
- metadata.gz: fb94bce07ae247f36c8b9a45332b562158fb7cc51e909c9d3d7737d3e7e30201
4
- data.tar.gz: 98b3fe59cc0022810e87a0aa5b3485d8522ea99c03f9f26133982b5b471e4bab
3
+ metadata.gz: 27beefad8d889787f2000e3b075ffb766f352a7d69d113ecad7329dcde401aad
4
+ data.tar.gz: 0602cac538c208fe5165f5272ebd6985cf18ce444c6c14e34b947be2660661a9
5
5
  SHA512:
6
- metadata.gz: 26e76e6bd2031e4856534a23977d32c8dd674266ee371c9623e498e171b467b90c40c814f19ca337564702124c395efac8b40738126f1346426b40bf315d47a9
7
- data.tar.gz: f075cdff765cd1b22e80866bded4e9921662d7f773f31428d75e72e192ddf71f20316286f6f237a9279121c192493d8fd8a93ba795e01c07720e0421f915be7f
6
+ metadata.gz: cfce54de7c40c3e7eb8aa6c526746b1dcdb4518d8cb958cf1a13a1e509c2db305b9b55d706280a036e9e7de4c1082c0b06050dddabd2e3564803bdf611b4b2de
7
+ data.tar.gz: 282a32a5cbc54a7ebe963fcd6288b157630de02741184f2f1b947efc230344609c9e61306a62ead963e4d65c98e0c8645717930fe98f90e4633204edc48fb869
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # Templates
2
- [![Gem Version](http://img.shields.io/gem/v/templates-rails.svg)](https://github.com/Ancez/templates-rails/blob/master/CHANGELOG.md)
2
+ [![Gem Version](https://badge.fury.io/rb/templates-rails.svg)](https://badge.fury.io/rb/templates-rails)
3
3
  [![Rspec](https://github.com/Ancez/templates-rails/actions/workflows/rspec.yml/badge.svg)](https://github.com/Ancez/templates-rails/actions/workflows/rspec.yml)
4
- [![Ruby Gem](https://github.com/Ancez/templates-rails/actions/workflows/gem-push.yml/badge.svg)](https://rubygems.org/gems/templates-rails)
5
4
 
6
5
  Simple to use templating system for your Rails application. Design your views before implementation.
7
6
 
@@ -9,7 +8,7 @@ Dummy can be viewed [here](https://templates-rails.herokuapp.com/).
9
8
 
10
9
  ## Installation
11
10
 
12
- Add this line to your application's Gemfile:
11
+ Add this line to your application's Gemfile under the `:development` group:
13
12
 
14
13
  ```ruby
15
14
  gem 'templates-rails'
@@ -17,24 +16,20 @@ gem 'templates-rails'
17
16
 
18
17
  And then execute:
19
18
 
20
- $ bundle install
19
+ bundle install
21
20
 
22
21
  Or install it yourself as:
23
22
 
24
- $ gem install templates-rails
23
+ gem install templates-rails --group development
25
24
 
26
- Run
27
-
28
- $ rake templates:install
29
- - This will add the templates engine to your routes by adding:
30
- - `mount Templates::Engine => '/'`
31
- - And will automatically generate `views/templates/example` directory and an example `.html.erb` file `/views/templates/example.html.erb`
32
- - It will also generate empty `partials` directories to showcase that you can still partialise your design views with a structure
33
- - `partials` directories are excluded from being shown within the indexes
25
+ ## TODO
26
+ - Finish the install rake task to generate the `templates` directory
27
+ - Setup a rake task for generating the layouts so users can pick their layouts
28
+ - Finish the specs
34
29
 
35
30
  ## Usage
31
+ - `partials` directories get ignored within the `views/templates` directory
36
32
 
37
- The rake task mentioned above generates examples for you to edit, delete and/or copy from.
38
33
 
39
34
  ## Development
40
35
 
@@ -1,4 +1,4 @@
1
- class Templates::TemplatesController < ApplicationController
1
+ class TemplatesController < ActionController::Base
2
2
  def index
3
3
  render :index, layout: 'templates/index'
4
4
  end
@@ -11,7 +11,7 @@
11
11
  <div class="templates__header">
12
12
  <div>
13
13
  <h1><%= yield(:title) if content_for?(:title) %></h1>
14
- <%= link_to 'Go Back', templates_path if params[:id].present? %>
14
+ <%= link_to 'Go Back', templates_engine.root_path if params[:id].present? %>
15
15
  </div>
16
16
  </div>
17
17
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  <div>
4
4
  <% Dir.children('./app/views/templates').excluding('partials').sort.each do |child| %>
5
- <%= link_to child.chomp('.html.erb').humanize.titleize, template_path(child.chomp('.html.erb')), class: 'button button--blue' %>
5
+ <%= link_to child.chomp('.html.erb').humanize.titleize, templates_engine.template_path(child.chomp('.html.erb')), class: 'button button--blue' %>
6
6
  <% end %>
7
7
  </div>
@@ -2,6 +2,6 @@
2
2
 
3
3
  <div>
4
4
  <% Dir.children("./app/views/templates/#{params[:id]}").excluding('partials').sort.each do |child| %>
5
- <%= link_to child.chomp('.html.erb').humanize.titleize, template_path("#{params[:id]}/#{child.chomp('.html.erb')}"), class: 'button button--blue' %>
5
+ <%= link_to child.chomp('.html.erb').humanize.titleize, templates_engine.template_path("#{params[:id]}/#{child.chomp('.html.erb')}"), class: 'button button--blue' %>
6
6
  <% end %>
7
7
  </div>
data/config/routes.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  Templates::Engine.routes.draw do
2
2
  root 'templates#index'
3
- resources :templates, only: [:index, :show]
3
+ get ':id', to: 'templates#show', as: :template
4
4
  end
@@ -1,9 +1,13 @@
1
1
  module Templates
2
2
  class Engine < ::Rails::Engine
3
- isolate_namespace Templates
3
+ initializer 'templates', before: :load_config_initializers do
4
+ Rails.application.routes.append do
5
+ mount Templates::Engine => '/templates' if Rails.env.development?
6
+ end
7
+ end
4
8
 
5
9
  initializer 'templates.assets.precompile' do |app|
6
- app.config.assets.precompile += %w( application.css )
10
+ app.config.assets.precompile += %w( templates/application.css )
7
11
  end
8
12
  end
9
13
  end
@@ -1,3 +1,3 @@
1
1
  module Templates
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: templates-rails
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
  - Lukasz Czapiewski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-14 00:00:00.000000000 Z
11
+ date: 2022-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,11 +38,11 @@ files:
38
38
  - Rakefile
39
39
  - app/assets/config/templates_manifest.js
40
40
  - app/assets/stylesheets/templates/application.css
41
- - app/controllers/templates/templates_controller.rb
41
+ - app/controllers/templates_controller.rb
42
42
  - app/views/layouts/templates/index.html.erb
43
43
  - app/views/layouts/templates/show.html.erb
44
- - app/views/templates/templates/index.html.erb
45
- - app/views/templates/templates/nested_index.html.erb
44
+ - app/views/templates/index.html.erb
45
+ - app/views/templates/nested_index.html.erb
46
46
  - config/routes.rb
47
47
  - lib/install/templates.rb
48
48
  - lib/tasks/templates_tasks.rake