crumbs 2.1.2 → 4.0.0.0
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/MIT-LICENSE +1 -1
- data/README.md +31 -41
- data/Rakefile +1 -14
- data/lib/crumbs/definitions.rb +26 -0
- data/lib/crumbs/dsl/controller.rb +7 -11
- data/lib/crumbs/dsl/namespace.rb +8 -4
- data/lib/crumbs/extensions/action_controller/base.rb +43 -0
- data/lib/crumbs/proxy.rb +10 -7
- data/lib/crumbs/railtie.rb +4 -2
- data/lib/crumbs/version.rb +1 -1
- data/lib/crumbs.rb +7 -38
- data/lib/generators/crumbs/install/install_generator.rb +15 -0
- data/test/dummy/Rakefile +1 -2
- data/test/dummy/app/assets/javascripts/application.js +2 -2
- data/test/dummy/app/assets/stylesheets/application.css +6 -4
- data/test/dummy/app/controllers/admin/reports/deliveries_controller.rb +6 -0
- data/test/dummy/app/controllers/admin/users_controller.rb +9 -0
- data/test/dummy/app/controllers/pages_controller.rb +0 -21
- data/test/dummy/app/views/application/_crumbs.html.erb +3 -0
- data/test/dummy/app/views/application/index.html.erb +1 -0
- data/test/dummy/app/views/application/show.html.erb +1 -0
- data/test/dummy/app/views/layouts/application.html.erb +9 -11
- data/test/dummy/bin/bundle +1 -0
- data/test/dummy/bin/rails +2 -1
- data/test/dummy/bin/rake +1 -0
- data/test/dummy/bin/setup +30 -0
- data/test/dummy/config/application.rb +6 -1
- data/test/dummy/config/boot.rb +1 -1
- data/test/dummy/config/crumbs.rb +15 -12
- data/test/dummy/config/environment.rb +1 -1
- data/test/dummy/config/environments/development.rb +14 -5
- data/test/dummy/config/environments/production.rb +18 -26
- data/test/dummy/config/environments/test.rb +10 -12
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/mime_types.rb +1 -2
- data/test/dummy/config/initializers/session_store.rb +1 -1
- data/test/dummy/config/locales/en.yml +1 -23
- data/test/dummy/config/routes.rb +9 -70
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +1 -1
- data/test/dummy/log/development.log +0 -0
- data/test/dummy/log/test.log +1050 -0
- data/test/dummy/public/404.html +58 -55
- data/test/dummy/public/422.html +58 -55
- data/test/dummy/public/500.html +57 -54
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/5L/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/8e/8eFn-IE_QAK9wkb3vBoqeyKxaN7o1hbJQnrz-uVvvQA.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/OI/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/RP/RPShcX3Jre4zxu1UEaxs1Tw4slXRjICXTyfQvtEWC7M.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/SG/SGNGr7AZfBE1q7ev2-YM1G-o0XAZ0pKqbsS3NvHtRcA.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/fG/fG_uaNK13wisQiji91xNsGecGxX9QhMCF2eSX_aR0G0.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/gb/gbunrAFVOHPwl2npUgKv_C3f_qiJnZDd9zG5-h3jrpo.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/hZ/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/mv/mvqN6PphkrOOC8zbUEhpC_9E_4ybdO25MRy_gG6dq3Y.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/nm/nmcUZlKAIwyJ_35Nm9P8pukLeRX5aApP6NFj5MpNPgc.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/pE/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/sB/sB6xWxBmgzVC0Co9__ANYrE58lr4WPwiwFa9mswooWM.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/va/vaNrIny9hchHD9eIJxAicyYLC7qeV4PTh4Nh40_Y6Vg.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/xd/xdBKQyhEAlDIstGvXw945PWJoEWi23rKuY7elOcWqHc.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/yv/yv8GQNKBriraHQF7esI3Zifw_OgHI0-bFlUD2nbZ3fw.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/zn/znrkcru9CbH2razkpdTQATvom11yKHllvnOQyyPSJAo.cache +0 -0
- data/test/generator_test.rb +5 -6
- data/test/test_helper.rb +4 -13
- data/test/view_test.rb +40 -0
- metadata +71 -31
- data/lib/crumbs/action_controller/base.rb +0 -47
- data/lib/generators/crumbs/install_generator.rb +0 -14
- data/lib/generators/crumbs/templates/configure.rb +0 -2
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/app/controllers/namespace/pages_controller.rb +0 -8
- data/test/dummy/app/views/pages/crumbs.html.erb +0 -3
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/initializers/secret_token.rb +0 -13
- data/test/dummy/db/schema.rb +0 -16
- data/test/with_last_test.rb +0 -553
- data/test/without_last_test.rb +0 -495
- /data/lib/generators/crumbs/{templates/define.rb → install/templates/configuration.rb} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 91cfd4a3627443e9244d089d713946a5e526d9fa
|
|
4
|
+
data.tar.gz: 2c519f7541e3ece7b0b0610459f992687cd32759
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a95f3e6439c69f5bd0315f2ad1141cfc66e95ae9bd8c581fdc407b48260b7fd37b5626edc954dd2c8fb534fb9545775fc79e7d259ef372fadda39bd52cf0b13
|
|
7
|
+
data.tar.gz: 34af90429178f5832ef5eaa74531a19a809a353a6eada0e6da695bb1314d182a1b9b83ebf0b6acc897861ee40f2082b6abe6107807a05986328ff1f3d5164480
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -5,7 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
# Crumbs
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Handy crumbs variable for rails views.
|
|
9
|
+
|
|
10
|
+
## Why
|
|
11
|
+
|
|
12
|
+
I did this gem to:
|
|
13
|
+
|
|
14
|
+
- Have a dsl separate from the controllers to define crumbs.
|
|
15
|
+
- Make crumbs remember query parameters from previous requests.
|
|
9
16
|
|
|
10
17
|
## Install
|
|
11
18
|
|
|
@@ -19,89 +26,72 @@ Then bundle:
|
|
|
19
26
|
$ bundle
|
|
20
27
|
```
|
|
21
28
|
|
|
29
|
+
NOTE: Because this gem stores queries in session, you may need a gem like redis-store to prevent cookies overflow.
|
|
30
|
+
|
|
22
31
|
## Configuration
|
|
23
32
|
|
|
24
|
-
Generate the
|
|
33
|
+
Generate the configuration file:
|
|
25
34
|
```
|
|
26
|
-
rails g crumbs:install
|
|
35
|
+
$ bundle exec rails g crumbs:install
|
|
27
36
|
```
|
|
28
37
|
|
|
29
|
-
|
|
30
|
-
```ruby
|
|
31
|
-
Crumbs.configure do |config|
|
|
32
|
-
config.show_last = false
|
|
33
|
-
end
|
|
34
|
-
```
|
|
38
|
+
## Usage
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
### Definitions
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
Use the crumb method to define a crumb:
|
|
39
43
|
```ruby
|
|
40
44
|
Crumbs.define do
|
|
41
|
-
|
|
42
|
-
action :index, 'Home'
|
|
43
|
-
end
|
|
45
|
+
crumb 'pages#index', 'Home'
|
|
44
46
|
end
|
|
45
47
|
```
|
|
46
48
|
|
|
47
|
-
To translate
|
|
49
|
+
To translate the name you can use the t shortcut method, will prepend "crumbs" to the key:
|
|
48
50
|
```ruby
|
|
49
51
|
Crumbs.define do
|
|
50
|
-
|
|
51
|
-
action :index, t('.home')
|
|
52
|
-
end
|
|
52
|
+
crumb 'pages#index', t('.home')
|
|
53
53
|
end
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
For dynamic names you can use a block, will receive the corresponding parameters:
|
|
57
57
|
```ruby
|
|
58
58
|
Crumbs.define do
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
action :index, 'Products'
|
|
62
|
-
end
|
|
59
|
+
crumb 'products#show' do |params|
|
|
60
|
+
Product.find(params[:id]).name
|
|
63
61
|
end
|
|
64
62
|
end
|
|
65
63
|
```
|
|
66
64
|
|
|
67
|
-
|
|
65
|
+
If you need to add multiple crumbs to the same controller:
|
|
68
66
|
```ruby
|
|
69
67
|
Crumbs.define do
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
namespace :admin do
|
|
69
|
+
controller :users do
|
|
70
|
+
crumb :index, 'Users'
|
|
71
|
+
crumb :edit, 'Edit user'
|
|
73
72
|
end
|
|
74
73
|
end
|
|
75
74
|
end
|
|
76
75
|
```
|
|
77
76
|
|
|
78
|
-
|
|
77
|
+
### Performance
|
|
79
78
|
|
|
80
|
-
To disable
|
|
79
|
+
To disable crums in some controller:
|
|
81
80
|
```ruby
|
|
82
81
|
class Api::BaseController < ApplicationController
|
|
83
82
|
skip_before_action :set_crumbs
|
|
84
83
|
end
|
|
85
84
|
```
|
|
86
85
|
|
|
87
|
-
|
|
86
|
+
### Views
|
|
88
87
|
|
|
89
|
-
|
|
88
|
+
Crumbs variable will be available in your views:
|
|
90
89
|
```erb
|
|
91
90
|
<% @crumbs.each do |crumb| %>
|
|
92
|
-
> <%= link_to crumb[:name], crumb[:
|
|
91
|
+
> <%= link_to crumb[:name], crumb[:url] %>
|
|
93
92
|
<% end %>
|
|
94
93
|
```
|
|
95
94
|
|
|
96
|
-
## Last crumb
|
|
97
|
-
|
|
98
|
-
If you want to show the last crumb, change the default in your config/initializers/crumbs.rb:
|
|
99
|
-
```ruby
|
|
100
|
-
Crumbs.configure do |config|
|
|
101
|
-
config.crumbs.show_last = true
|
|
102
|
-
end
|
|
103
|
-
```
|
|
104
|
-
|
|
105
95
|
## Credits
|
|
106
96
|
|
|
107
97
|
This gem is maintained and funded by [mmontossi](https://github.com/mmontossi).
|
data/Rakefile
CHANGED
|
@@ -4,19 +4,6 @@ rescue LoadError
|
|
|
4
4
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
-
require 'rdoc/task'
|
|
8
|
-
|
|
9
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
|
10
|
-
rdoc.rdoc_dir = 'rdoc'
|
|
11
|
-
rdoc.title = 'Crumbs'
|
|
12
|
-
rdoc.options << '--line-numbers'
|
|
13
|
-
rdoc.rdoc_files.include('README.rdoc')
|
|
14
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
7
|
Bundler::GemHelper.install_tasks
|
|
21
8
|
|
|
22
9
|
require 'rake/testtask'
|
|
@@ -26,7 +13,7 @@ Rake::TestTask.new(:test) do |t|
|
|
|
26
13
|
t.libs << 'test'
|
|
27
14
|
t.pattern = 'test/**/*_test.rb'
|
|
28
15
|
t.verbose = false
|
|
16
|
+
t.warning = false
|
|
29
17
|
end
|
|
30
18
|
|
|
31
|
-
|
|
32
19
|
task default: :test
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Crumbs
|
|
2
|
+
class Definitions
|
|
3
|
+
|
|
4
|
+
def find(id, params)
|
|
5
|
+
if registry.has_key?(id)
|
|
6
|
+
name = registry[id]
|
|
7
|
+
if name.is_a?(Proc)
|
|
8
|
+
name.call params
|
|
9
|
+
else
|
|
10
|
+
name
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def add(id, name)
|
|
16
|
+
registry[id] = name
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def registry
|
|
22
|
+
@registry ||= {}
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
module Crumbs
|
|
2
|
-
module
|
|
2
|
+
module Dsl
|
|
3
3
|
class Controller
|
|
4
4
|
|
|
5
|
-
def initialize(
|
|
6
|
-
@
|
|
5
|
+
def initialize(prefix, &block)
|
|
6
|
+
@prefix = prefix
|
|
7
7
|
instance_eval &block
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
-
def
|
|
11
|
-
Crumbs.add(
|
|
12
|
-
@controller.to_s,
|
|
13
|
-
action.to_s,
|
|
14
|
-
(block_given? ? block : name)
|
|
15
|
-
)
|
|
10
|
+
def crumb(action, name=nil, &block)
|
|
11
|
+
Crumbs.definitions.add "#{@prefix}##{action}", (block_given? ? block : name)
|
|
16
12
|
end
|
|
17
13
|
|
|
18
14
|
def t(key)
|
|
19
|
-
if key.starts_with?
|
|
15
|
+
if key.starts_with?('.')
|
|
20
16
|
key.prepend 'crumbs'
|
|
21
17
|
end
|
|
22
|
-
I18n.t
|
|
18
|
+
I18n.t key
|
|
23
19
|
end
|
|
24
20
|
|
|
25
21
|
end
|
data/lib/crumbs/dsl/namespace.rb
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
module Crumbs
|
|
2
|
-
module
|
|
2
|
+
module Dsl
|
|
3
3
|
class Namespace
|
|
4
4
|
|
|
5
|
-
def initialize(
|
|
6
|
-
@
|
|
5
|
+
def initialize(prefix, &block)
|
|
6
|
+
@prefix = prefix
|
|
7
7
|
instance_eval &block
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def controller(name, &block)
|
|
11
|
-
Controller.new
|
|
11
|
+
Controller.new "#{@prefix}/#{name}", &block
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def namespace(name, &block)
|
|
15
|
+
Namespace.new "#{@prefix}/#{name}", &block
|
|
12
16
|
end
|
|
13
17
|
|
|
14
18
|
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
module Crumbs
|
|
2
|
+
module Extensions
|
|
3
|
+
module ActionController
|
|
4
|
+
module Base
|
|
5
|
+
extend ActiveSupport::Concern
|
|
6
|
+
|
|
7
|
+
included do
|
|
8
|
+
before_action :set_crumbs
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
private
|
|
12
|
+
|
|
13
|
+
def set_crumbs
|
|
14
|
+
paths = [request.path]
|
|
15
|
+
until paths.first == '/'
|
|
16
|
+
paths.prepend File.dirname(paths.first)
|
|
17
|
+
end
|
|
18
|
+
session[:referers] ||= {}
|
|
19
|
+
url, query = request.url.split(/\/?\?/)
|
|
20
|
+
if query
|
|
21
|
+
session[:referers][url] = query
|
|
22
|
+
end
|
|
23
|
+
@crumbs = []
|
|
24
|
+
paths.each do |path|
|
|
25
|
+
url = "#{request.base_url}#{path}".remove(/\/$/)
|
|
26
|
+
begin
|
|
27
|
+
params = Rails.application.routes.recognize_path(url)
|
|
28
|
+
rescue
|
|
29
|
+
next
|
|
30
|
+
end
|
|
31
|
+
if name = Crumbs.definitions.find("#{params[:controller]}##{params[:action]}", params)
|
|
32
|
+
if query = session[:referers][url]
|
|
33
|
+
url << "?#{query}"
|
|
34
|
+
end
|
|
35
|
+
@crumbs << { name: name, url: url }
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
data/lib/crumbs/proxy.rb
CHANGED
|
@@ -5,13 +5,16 @@ module Crumbs
|
|
|
5
5
|
instance_eval &block
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
def namespace(*args, &block)
|
|
9
|
+
Dsl::Namespace.new *args, &block
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def controller(*args, &block)
|
|
13
|
+
Dsl::Controller.new *args, &block
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def crumb(action, name=nil, &block)
|
|
17
|
+
Crumbs.definitions.add action, (block_given? ? block : name)
|
|
15
18
|
end
|
|
16
19
|
|
|
17
20
|
end
|
data/lib/crumbs/railtie.rb
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
module Crumbs
|
|
2
2
|
class Railtie < Rails::Railtie
|
|
3
3
|
|
|
4
|
-
initializer 'crumbs' do
|
|
5
|
-
::ActionController::Base.
|
|
4
|
+
initializer 'crumbs.extensions' do
|
|
5
|
+
::ActionController::Base.include(
|
|
6
|
+
Crumbs::Extensions::ActionController::Base
|
|
7
|
+
)
|
|
6
8
|
end
|
|
7
9
|
|
|
8
10
|
config.after_initialize do
|
data/lib/crumbs/version.rb
CHANGED
data/lib/crumbs.rb
CHANGED
|
@@ -1,51 +1,20 @@
|
|
|
1
|
-
require 'crumbs/action_controller/base'
|
|
2
|
-
require 'crumbs/proxy'
|
|
3
1
|
require 'crumbs/dsl/namespace'
|
|
4
2
|
require 'crumbs/dsl/controller'
|
|
3
|
+
require 'crumbs/extensions/action_controller/base'
|
|
4
|
+
require 'crumbs/definitions'
|
|
5
|
+
require 'crumbs/proxy'
|
|
5
6
|
require 'crumbs/railtie'
|
|
7
|
+
require 'crumbs/version'
|
|
6
8
|
|
|
7
9
|
module Crumbs
|
|
8
10
|
class << self
|
|
9
11
|
|
|
10
|
-
def configure
|
|
11
|
-
yield config
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def config
|
|
15
|
-
@config ||= begin
|
|
16
|
-
ActiveSupport::OrderedOptions.new.tap do |config|
|
|
17
|
-
config.show_last = false
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
12
|
def define(&block)
|
|
23
|
-
Proxy.new
|
|
13
|
+
Proxy.new &block
|
|
24
14
|
end
|
|
25
15
|
|
|
26
|
-
def
|
|
27
|
-
|
|
28
|
-
name = registry[controller][action]
|
|
29
|
-
if name.is_a? Proc
|
|
30
|
-
name.call params
|
|
31
|
-
else
|
|
32
|
-
name
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def add(controller, action, name)
|
|
38
|
-
if registry.has_key? controller
|
|
39
|
-
registry[controller][action] = name
|
|
40
|
-
else
|
|
41
|
-
registry[controller] = { action => name }
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
protected
|
|
46
|
-
|
|
47
|
-
def registry
|
|
48
|
-
@registry ||= {}
|
|
16
|
+
def definitions
|
|
17
|
+
@definitions ||= Definitions.new
|
|
49
18
|
end
|
|
50
19
|
|
|
51
20
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
|
|
3
|
+
module Crumbs
|
|
4
|
+
module Generators
|
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
|
6
|
+
|
|
7
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
8
|
+
|
|
9
|
+
def create_configuration_file
|
|
10
|
+
copy_file 'configuration.rb', 'config/crumbs.rb'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
data/test/dummy/Rakefile
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// listed below.
|
|
3
3
|
//
|
|
4
4
|
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
-
// or vendor/assets/javascripts
|
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
|
6
6
|
//
|
|
7
7
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
8
|
// compiled file.
|
|
9
9
|
//
|
|
10
|
-
// Read Sprockets README (https://github.com/
|
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
|
11
11
|
// about supported directives.
|
|
12
12
|
//
|
|
13
13
|
//= require_tree .
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
* listed below.
|
|
4
4
|
*
|
|
5
5
|
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
-
* or vendor/assets/stylesheets
|
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
7
|
*
|
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the
|
|
9
|
-
* compiled file
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
|
11
|
+
* file per style scope.
|
|
10
12
|
*
|
|
11
|
-
*= require_self
|
|
12
13
|
*= require_tree .
|
|
14
|
+
*= require_self
|
|
13
15
|
*/
|
|
@@ -1,27 +1,6 @@
|
|
|
1
1
|
class PagesController < ApplicationController
|
|
2
2
|
|
|
3
3
|
def index
|
|
4
|
-
render :crumbs
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
def static
|
|
8
|
-
render :crumbs
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def i18n
|
|
12
|
-
render :crumbs
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def nested
|
|
16
|
-
render :crumbs
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def param
|
|
20
|
-
render :crumbs
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def empty
|
|
24
|
-
render :crumbs
|
|
25
4
|
end
|
|
26
5
|
|
|
27
6
|
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= render 'crumbs' %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= render 'crumbs' %>
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html>
|
|
3
|
-
<head>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
</body>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
|
7
|
+
<%= csrf_meta_tags %>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<%= yield %>
|
|
11
|
+
</body>
|
|
14
12
|
</html>
|
data/test/dummy/bin/bundle
CHANGED
data/test/dummy/bin/rails
CHANGED
data/test/dummy/bin/rake
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'pathname'
|
|
4
|
+
|
|
5
|
+
# path to your application root.
|
|
6
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
|
7
|
+
|
|
8
|
+
Dir.chdir APP_ROOT do
|
|
9
|
+
# This script is a starting point to setup your application.
|
|
10
|
+
# Add necessary setup steps to this file:
|
|
11
|
+
|
|
12
|
+
puts '== Installing dependencies =='
|
|
13
|
+
system 'gem install bundler --conservative'
|
|
14
|
+
system 'bundle check || bundle install'
|
|
15
|
+
|
|
16
|
+
# puts "\n== Copying sample files =="
|
|
17
|
+
# unless File.exist?('config/database.yml')
|
|
18
|
+
# system 'cp config/database.yml.sample config/database.yml'
|
|
19
|
+
# end
|
|
20
|
+
|
|
21
|
+
puts "\n== Preparing database =="
|
|
22
|
+
system 'bin/rake db:setup'
|
|
23
|
+
|
|
24
|
+
puts "\n== Removing old logs and tempfiles =="
|
|
25
|
+
system 'rm -f log/*'
|
|
26
|
+
system 'rm -rf tmp/cache'
|
|
27
|
+
|
|
28
|
+
puts "\n== Restarting application server =="
|
|
29
|
+
system 'touch tmp/restart.txt'
|
|
30
|
+
end
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
require File.expand_path('../boot', __FILE__)
|
|
2
2
|
|
|
3
|
-
require '
|
|
3
|
+
require 'active_model/railtie'
|
|
4
|
+
require 'action_controller/railtie'
|
|
5
|
+
require 'action_mailer/railtie'
|
|
6
|
+
require 'action_view/railtie'
|
|
7
|
+
require 'sprockets/railtie'
|
|
8
|
+
require 'rails/test_unit/railtie'
|
|
4
9
|
|
|
5
10
|
Bundler.require(*Rails.groups)
|
|
6
11
|
require 'crumbs'
|
data/test/dummy/config/boot.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Set up gems listed in the Gemfile.
|
|
2
2
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
|
|
3
3
|
|
|
4
|
-
require 'bundler/setup' if File.
|
|
4
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
|
5
5
|
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
|
data/test/dummy/config/crumbs.rb
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
Crumbs.define do
|
|
2
2
|
|
|
3
|
-
namespace :
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
namespace :admin do
|
|
4
|
+
namespace :reports do
|
|
5
|
+
controller :deliveries do
|
|
6
|
+
crumb :index do
|
|
7
|
+
'deliveries'
|
|
8
|
+
end
|
|
9
|
+
end
|
|
6
10
|
end
|
|
11
|
+
controller :users do
|
|
12
|
+
crumb :index, 'users'
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
crumb 'admin/users#show' do |params|
|
|
17
|
+
"user #{params[:id]}"
|
|
7
18
|
end
|
|
8
19
|
|
|
9
20
|
controller :pages do
|
|
10
|
-
|
|
11
|
-
action :nested, 'Nested'
|
|
12
|
-
action :i18n, t('.hello')
|
|
13
|
-
action :static do
|
|
14
|
-
t('.static')
|
|
15
|
-
end
|
|
16
|
-
action :param do |params|
|
|
17
|
-
"Param#{params[:param]}"
|
|
18
|
-
end
|
|
21
|
+
crumb :index, t('.home')
|
|
19
22
|
end
|
|
20
23
|
|
|
21
24
|
end
|