ecm_tags 2.1.0 → 2.2.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/app/models/ecm/tags/tagging.rb +16 -0
- data/config/initializers/inject_taggable_concern.rb +6 -0
- data/config/locales/de.yml +18 -8
- data/config/locales/en.yml +21 -8
- data/lib/ecm/tags/configuration.rb +3 -3
- data/lib/ecm/tags/engine.rb +0 -7
- data/lib/ecm/tags/version.rb +1 -1
- data/lib/generators/ecm/tags/install/templates/initializer.rb +10 -5
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/javascripts/posts.js +2 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/assets/stylesheets/posts.css +4 -0
- data/spec/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/frontend_controller.rb +2 -0
- data/spec/dummy/app/controllers/posts_controller.rb +59 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/helpers/posts_helper.rb +2 -0
- data/spec/dummy/app/models/post.rb +4 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/posts/_form.html.erb +25 -0
- data/spec/dummy/app/views/posts/_post.html.erb +3 -0
- data/spec/dummy/app/views/posts/edit.html.erb +6 -0
- data/spec/dummy/app/views/posts/index.html.erb +29 -0
- data/spec/dummy/app/views/posts/new.html.erb +5 -0
- data/spec/dummy/app/views/posts/show.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +31 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +5 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20160212133931_create_ecm_tags_tags.ecm_tags.rb +11 -0
- data/spec/dummy/db/migrate/20160212133932_create_ecm_tags_taggings.ecm_tags.rb +18 -0
- data/spec/dummy/db/migrate/20160212134222_create_posts.rb +10 -0
- data/spec/dummy/db/schema.rb +41 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/spec/controllers/posts_controller_spec.rb +157 -0
- data/spec/dummy/spec/factories/posts.rb +6 -0
- data/spec/dummy/spec/helpers/posts_helper_spec.rb +15 -0
- data/spec/dummy/spec/models/post_spec.rb +5 -0
- data/spec/dummy/spec/requests/posts_spec.rb +10 -0
- data/spec/dummy/spec/routing/posts_routing_spec.rb +37 -0
- data/spec/dummy/spec/views/posts/edit.html.erb_spec.rb +20 -0
- data/spec/dummy/spec/views/posts/index.html.erb_spec.rb +22 -0
- data/spec/dummy/spec/views/posts/new.html.erb_spec.rb +20 -0
- data/spec/dummy/spec/views/posts/show.html.erb_spec.rb +16 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-Rk46EWcF9JNQvs4jamoC5UetyQe_Liydnzz339Ah5c.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-tiBAjaN_MhRxnGs10DJTQjnj4h1yRQkeejcmBYdwJo.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2Yi2yjcAHgeIXKOYmsGlDp7Jc9-YxdBAerr4uk4uO0Q.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/3vFcUkP2kWu2iktHlcSC_OfjYi3u_BqXmoCf2gvEE2M.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/4JaU4ZW9j_RMb-z_fzYbPLoZctdUv0Fzt3_U-gy3kAw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5P-OzgUkwyAgoOv7CZL2UfSgs4rcG7DcMYr5WUkHaZc.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5TzYmONEI2HYkxGdPZU9iJFCuuoe70CB-i-w-KEHZv0.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/6H66m5FQazePA0g_qkHvuCMPzaPtznXdj-yAWWUtPnw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/7C_O90lo1Yi2b0Ed9bpFF6gUVqTrK_4goAv2_cdLnSI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8wkEYFnE3ZJ8vdlwNXJpFg1xc81ULuNYx7O-FuYA55w.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/AAiF0geR48ctD2aHAqAVSLKQFWesFqJLP-ZGPId5wWM.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ClUHQDSdna_TRtjSG_r6jD3hQEmJ_laO_2IDDTNafGw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/DesJkeilWecg6a2hoWgP6KtHYFXVculbTQwOY824Ov0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/DmmfrCpXtt74Hr6NO54lxyOCDv6klnDyBqeDFR7oDU8.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ETOLFW7z9GHBdRPSYUVj-RVoXPXxMmOc86KlwkUFXWM.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/FQvx5zKlMSn1gKaT7Elj4CgsWHC-_8FYDN_VO0vyGH4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/I-Fn3is-YC5z6FFns4kf2DQWiNPmSh5FE6mqR4hNeqY.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/JAmHv7GyzaWXmLMT2CiP8pUuvPOX7gNlyP7DcId3xcA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/JIV6P9o3lv6AF-6_7Yd35SryD44vS_LPdThsYeXjgQk.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/KB1t0DQJfRViGhML3u0NuVlVpQHjbFYWs_SrFvbXQB0.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/M76cE2oAZjvfK9meOD0uCS1k5slLFYxmtLiMykNl1oY.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/MWYCQbJoVG_HtuEyKiBNUM4zGAV9pVXr6uoxvtpixrE.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Q8H_klVplUAUyXyRxcoz5K3HyirGXjwxQ9-6sTKm74U.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/RSK82eed7XubPBRL-4jf0eOlKgtGg-ooQXrY0F4W194.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Z_pLuEtd8bZcpv5q0r6aYNl9SP4KClCsP-i0wAOelmM.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/dlQOci5ZlcWlh7tHZpxpamNwe343IjDbezrfcPEcPw0.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/egxIcSNP_AHgCIboNW03qbGhxwrCOcPqms6nGntC7Fs.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/i18WqDjAKooAMM0YPXJRMtHBycPcmo-BU8eoqXKyfPU.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/jVD7-rQv89s_Pta-2_Sf9U7i8ao1gix2Lp90ISIkasA.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/nWo2ysO8pNRVLI4LiUqzjyZyrU1cIxq20bSCDbgswdM.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ompUzgaB0qfmoE6djKuHjLjMYlToLX0_lb6iFwWPO0o.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pOoJAHtZ3sqU9_DaqDFTu0HPRhuSfgJDE8bdi9IVlI4.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pzyYjBHQiM-yOIhztKOpuHU7Jepq82zWJg-mzp5L418.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wJMzpOMn4cGBbHRf1uOBEApoBZag48B9djjpFhAG8mE.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wafl6XJiIk4VCd-yj42MMaao0dyAqQSTSPn0YiXvElQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xuNJ32gKsrwphnFigSODyGeYqNKhBBSa49ffAXRJ8jg.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zF3sNycdAc5fpqhKKmuKS2F2Zc-OkZ-T2Qiqq4ywang.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zMHd1CpL0ukpIS90SExzXc3eTzMQreOm__lG4fVygp8.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zPep_9K14vA0ICucNx5t8umt9e2caMo0jvNg80b4kJs.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zt-2He-6ayIMtuqNcliVhJNUcEnCi6M39pTVaXV9VjA.cache +0 -0
- data/spec/factories/ecm_tags_taggings.rb +6 -0
- data/spec/factories/ecm_tags_tags.rb +6 -0
- data/spec/features/ecm/tags/search_spec.rb +19 -0
- data/spec/models/ecm/tags/tag_search_spec.rb +43 -0
- data/spec/rails_helper.rb +57 -0
- data/spec/spec_helper.rb +90 -0
- data/spec/support/capybara.rb +1 -0
- data/spec/support/factory_girl_rails.rb +5 -0
- data/spec/support/formulaic.rb +5 -0
- data/spec/support/shoulda_matchers.rb +8 -0
- metadata +120 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bbd0e62a081a5db9b51441c38d589727952cc4a8
|
|
4
|
+
data.tar.gz: b1658ebc6c92982338b9735f998c198667f32023
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2102c9d667f4ac5f1e4125990e696e68f49a61986d4c1b66656ea4a7311604d82cc134b452d4fcb5fabdb353b567450dcdae875805b81f524f6162704981c335
|
|
7
|
+
data.tar.gz: 9eb61fc02a79138736602d7ed1b85e773b035276349bd10c2450b99b28dfd09fb91889e8a31ea8a5137c03847d973848ad26ab74c97fea5619dc72cfb692e07b
|
|
@@ -3,5 +3,21 @@ module Ecm::Tags
|
|
|
3
3
|
def human
|
|
4
4
|
"#{taggable} - #{tag}"
|
|
5
5
|
end
|
|
6
|
+
|
|
7
|
+
def taggable=(taggable)
|
|
8
|
+
if taggable.is_a?(String)
|
|
9
|
+
super(GlobalID::Locator.locate(taggable))
|
|
10
|
+
else
|
|
11
|
+
super
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def tagger=(tagger)
|
|
16
|
+
if tagger.is_a?(String)
|
|
17
|
+
super(GlobalID::Locator.locate(tagger))
|
|
18
|
+
else
|
|
19
|
+
super
|
|
20
|
+
end
|
|
21
|
+
end
|
|
6
22
|
end
|
|
7
23
|
end
|
data/config/locales/de.yml
CHANGED
|
@@ -4,26 +4,36 @@ de:
|
|
|
4
4
|
attributes:
|
|
5
5
|
tag_list: Tags
|
|
6
6
|
activerecord:
|
|
7
|
+
models:
|
|
8
|
+
ecm/tags/tag:
|
|
9
|
+
one: Tag
|
|
10
|
+
other: Tags
|
|
11
|
+
ecm/tags/tagging:
|
|
12
|
+
one: Tagging
|
|
13
|
+
other: Taggings
|
|
7
14
|
attributes:
|
|
8
15
|
ecm/tags/tag:
|
|
16
|
+
id: ID
|
|
17
|
+
color: Farbe
|
|
9
18
|
name: Name
|
|
10
19
|
taggings_count: Getagte Objekte
|
|
11
20
|
ecm/tags/tagging:
|
|
21
|
+
id: ID
|
|
22
|
+
color: Farbe
|
|
23
|
+
context: Kontext
|
|
24
|
+
tag_id: Tag
|
|
12
25
|
tag: Tag
|
|
26
|
+
taggable_id: Getagtes Objekt
|
|
13
27
|
taggable: Getagtes Objekt
|
|
28
|
+
taggable_type: Getagtes Objekt-Typ
|
|
29
|
+
tagger_id: Ersteller
|
|
14
30
|
tagger: Ersteller
|
|
31
|
+
tagger_type: Ersteller-Typ
|
|
15
32
|
created_at: Erstellt am
|
|
16
|
-
|
|
33
|
+
updated_at: Aktualisiert am
|
|
17
34
|
ecm/tags/tag_search:
|
|
18
35
|
exact: Wortgenau
|
|
19
36
|
tag_list: Tags
|
|
20
|
-
models:
|
|
21
|
-
ecm/tags/tag:
|
|
22
|
-
one: Tag
|
|
23
|
-
other: Tags
|
|
24
|
-
ecm/tags/tagging:
|
|
25
|
-
one: Tagging
|
|
26
|
-
other: Taggings
|
|
27
37
|
ecm:
|
|
28
38
|
tags:
|
|
29
39
|
search_box:
|
data/config/locales/en.yml
CHANGED
|
@@ -4,23 +4,36 @@ en:
|
|
|
4
4
|
attributes:
|
|
5
5
|
tag_list: Tags
|
|
6
6
|
activerecord:
|
|
7
|
+
models:
|
|
8
|
+
ecm/tags/tag:
|
|
9
|
+
one: Tag
|
|
10
|
+
other: Tags
|
|
11
|
+
ecm/tags/tagging:
|
|
12
|
+
one: Tagging
|
|
13
|
+
other: Taggings
|
|
7
14
|
attributes:
|
|
8
15
|
ecm/tags/tag:
|
|
16
|
+
id: ID
|
|
17
|
+
color: Color
|
|
9
18
|
name: Name
|
|
10
19
|
taggings_count: Tagged Items
|
|
11
20
|
ecm/tags/tagging:
|
|
21
|
+
id: ID
|
|
22
|
+
color: Color
|
|
23
|
+
context: Context
|
|
24
|
+
tag_id: Tag
|
|
12
25
|
tag: Tag
|
|
13
|
-
|
|
26
|
+
taggable_id: Taggable
|
|
27
|
+
taggable: Taggable
|
|
28
|
+
taggable_type: Taggable type
|
|
29
|
+
tagger_id: Tagger
|
|
30
|
+
tagger_type: Tagger type
|
|
14
31
|
tagger: Tagger
|
|
15
32
|
created_at: Created at
|
|
16
33
|
udpated_at: Updated at
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
other: Tags
|
|
21
|
-
ecm/tags/tag:
|
|
22
|
-
one: Tagging
|
|
23
|
-
other: Taggings
|
|
34
|
+
ecm/tags/tag_search:
|
|
35
|
+
exact: Exact
|
|
36
|
+
tag_list: Tags
|
|
24
37
|
ecm:
|
|
25
38
|
tags:
|
|
26
39
|
search_box:
|
|
@@ -11,10 +11,10 @@ module Ecm
|
|
|
11
11
|
mattr_accessor(:base_controller) { 'FrontendController' }
|
|
12
12
|
mattr_accessor(:add_submit_button_to_search_box) { true }
|
|
13
13
|
mattr_accessor(:tag_search_exact_default_value) { false }
|
|
14
|
-
mattr_accessor(:
|
|
14
|
+
mattr_accessor(:taggable_class_names) { [] }
|
|
15
15
|
|
|
16
|
-
def self.
|
|
17
|
-
@@
|
|
16
|
+
def self.taggable_classes
|
|
17
|
+
@@taggable_class_names.map(&:constantize)
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
end
|
data/lib/ecm/tags/engine.rb
CHANGED
|
@@ -2,13 +2,6 @@ module Ecm
|
|
|
2
2
|
module Tags
|
|
3
3
|
class Engine < ::Rails::Engine
|
|
4
4
|
isolate_namespace Ecm::Tags
|
|
5
|
-
|
|
6
|
-
config.after_initialize do
|
|
7
|
-
Configuration.taggable_models.each do |model|
|
|
8
|
-
puts "Including Models::Ecm::Tags::TaggableConcern in #{model}"
|
|
9
|
-
model.send(:include, Model::Ecm::Tags::TaggableConcern)
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
5
|
end
|
|
13
6
|
end
|
|
14
7
|
end
|
data/lib/ecm/tags/version.rb
CHANGED
|
@@ -6,21 +6,26 @@ Ecm::Tags.configure do |config|
|
|
|
6
6
|
config.base_controller = '<%= base_controller_class_name %>'
|
|
7
7
|
|
|
8
8
|
# Add a submit button to the tag search box.
|
|
9
|
-
#
|
|
9
|
+
#
|
|
10
10
|
# Default: config.add_submit_button_to_search_box = true
|
|
11
11
|
#
|
|
12
12
|
config.add_submit_button_to_search_box = true
|
|
13
13
|
|
|
14
14
|
# Use exact search by default or not.
|
|
15
|
-
#
|
|
15
|
+
#
|
|
16
16
|
# Default: config.tag_search_exact_default_value = false
|
|
17
17
|
#
|
|
18
18
|
config.tag_search_exact_default_value = false
|
|
19
19
|
|
|
20
|
-
|
|
21
20
|
# Specify the models to be tagged.
|
|
22
21
|
#
|
|
23
|
-
# Default: config.
|
|
22
|
+
# Default: config.taggable_class_names = %w()
|
|
23
|
+
#
|
|
24
|
+
config.taggable_class_names = %w()
|
|
25
|
+
|
|
26
|
+
# Specify the models the can tag things.
|
|
24
27
|
#
|
|
25
|
-
config.
|
|
28
|
+
# Default: config.tagger_class_names = %w()
|
|
29
|
+
#
|
|
30
|
+
config.tagger_class_names = %w()
|
|
26
31
|
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
== README
|
|
2
|
+
|
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
|
4
|
+
application up and running.
|
|
5
|
+
|
|
6
|
+
Things you may want to cover:
|
|
7
|
+
|
|
8
|
+
* Ruby version
|
|
9
|
+
|
|
10
|
+
* System dependencies
|
|
11
|
+
|
|
12
|
+
* Configuration
|
|
13
|
+
|
|
14
|
+
* Database creation
|
|
15
|
+
|
|
16
|
+
* Database initialization
|
|
17
|
+
|
|
18
|
+
* How to run the test suite
|
|
19
|
+
|
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
|
21
|
+
|
|
22
|
+
* Deployment instructions
|
|
23
|
+
|
|
24
|
+
* ...
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
|
28
|
+
<tt>rake doc:app</tt>.
|
data/spec/dummy/Rakefile
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// compiled file.
|
|
9
|
+
//
|
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
|
+
//
|
|
13
|
+
//= require_tree .
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
|
+
*
|
|
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.
|
|
12
|
+
*
|
|
13
|
+
*= require_tree .
|
|
14
|
+
*= require_self
|
|
15
|
+
*/
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
body { background-color: #fff; color: #333; }
|
|
2
|
+
|
|
3
|
+
body, p, ol, ul, td {
|
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
|
5
|
+
font-size: 13px;
|
|
6
|
+
line-height: 18px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
pre {
|
|
10
|
+
background-color: #eee;
|
|
11
|
+
padding: 10px;
|
|
12
|
+
font-size: 11px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
a { color: #000; }
|
|
16
|
+
a:visited { color: #666; }
|
|
17
|
+
a:hover { color: #fff; background-color:#000; }
|
|
18
|
+
|
|
19
|
+
div.field, div.actions {
|
|
20
|
+
margin-bottom: 10px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
#notice {
|
|
24
|
+
color: green;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.field_with_errors {
|
|
28
|
+
padding: 2px;
|
|
29
|
+
background-color: red;
|
|
30
|
+
display: table;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
#error_explanation {
|
|
34
|
+
width: 450px;
|
|
35
|
+
border: 2px solid red;
|
|
36
|
+
padding: 7px;
|
|
37
|
+
padding-bottom: 0;
|
|
38
|
+
margin-bottom: 20px;
|
|
39
|
+
background-color: #f0f0f0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#error_explanation h2 {
|
|
43
|
+
text-align: left;
|
|
44
|
+
font-weight: bold;
|
|
45
|
+
padding: 5px 5px 5px 15px;
|
|
46
|
+
font-size: 12px;
|
|
47
|
+
margin: -7px;
|
|
48
|
+
margin-bottom: 0px;
|
|
49
|
+
background-color: #c00;
|
|
50
|
+
color: #fff;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#error_explanation ul li {
|
|
54
|
+
font-size: 12px;
|
|
55
|
+
list-style: square;
|
|
56
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
class PostsController < ApplicationController
|
|
2
|
+
before_action :set_post, only: [:show, :edit, :update, :destroy]
|
|
3
|
+
|
|
4
|
+
# GET /posts
|
|
5
|
+
def index
|
|
6
|
+
@posts = Post.all
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# GET /posts/1
|
|
10
|
+
def show
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# GET /posts/new
|
|
14
|
+
def new
|
|
15
|
+
@post = Post.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# GET /posts/1/edit
|
|
19
|
+
def edit
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# POST /posts
|
|
23
|
+
def create
|
|
24
|
+
@post = Post.new(post_params)
|
|
25
|
+
|
|
26
|
+
if @post.save
|
|
27
|
+
redirect_to @post, notice: 'Post was successfully created.'
|
|
28
|
+
else
|
|
29
|
+
render :new
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# PATCH/PUT /posts/1
|
|
34
|
+
def update
|
|
35
|
+
if @post.update(post_params)
|
|
36
|
+
redirect_to @post, notice: 'Post was successfully updated.'
|
|
37
|
+
else
|
|
38
|
+
render :edit
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# DELETE /posts/1
|
|
43
|
+
def destroy
|
|
44
|
+
@post.destroy
|
|
45
|
+
redirect_to posts_url, notice: 'Post was successfully destroyed.'
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
|
|
50
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
51
|
+
def set_post
|
|
52
|
+
@post = Post.find(params[:id])
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Only allow a trusted parameter "white list" through.
|
|
56
|
+
def post_params
|
|
57
|
+
params.require(:post).permit(:title, :body)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
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
|
+
|
|
11
|
+
<%= yield %>
|
|
12
|
+
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|