ish_lib_engine 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/ish_lib_engine/application.js +13 -0
- data/app/assets/javascripts/ish_lib_engine/articles.js +2 -0
- data/app/assets/stylesheets/ish_lib_engine/application.css +15 -0
- data/app/assets/stylesheets/ish_lib_engine/articles.css +4 -0
- data/app/assets/stylesheets/scaffold.css +56 -0
- data/app/controllers/ish_lib_engine/application_controller.rb +4 -0
- data/app/controllers/ish_lib_engine/articles_controller.rb +62 -0
- data/app/controllers/ish_lib_engine/manager/cities_controller.rb +95 -0
- data/app/controllers/ish_lib_engine/manager/cities_controller.rb~ +95 -0
- data/app/controllers/ish_lib_engine/manager/features_controller.rb +122 -0
- data/app/controllers/ish_lib_engine/manager/features_controller.rb~ +122 -0
- data/app/controllers/ish_lib_engine/manager/galleries_controller.rb +78 -0
- data/app/controllers/ish_lib_engine/manager/galleries_controller.rb~ +78 -0
- data/app/controllers/ish_lib_engine/manager/manager_controller.rb +31 -0
- data/app/controllers/ish_lib_engine/manager/manager_controller.rb~ +31 -0
- data/app/controllers/ish_lib_engine/manager/newsitems_controller.rb +47 -0
- data/app/controllers/ish_lib_engine/manager/newsitems_controller.rb~ +47 -0
- data/app/controllers/ish_lib_engine/manager/photos_controller.rb +20 -0
- data/app/controllers/ish_lib_engine/manager/photos_controller.rb~ +20 -0
- data/app/controllers/ish_lib_engine/manager/reports_controller.rb +62 -0
- data/app/controllers/ish_lib_engine/manager/reports_controller.rb~ +62 -0
- data/app/controllers/ish_lib_engine/manager/sites_controller.rb +72 -0
- data/app/controllers/ish_lib_engine/manager/sites_controller.rb~ +72 -0
- data/app/controllers/ish_lib_engine/manager/tags_controller.rb +54 -0
- data/app/controllers/ish_lib_engine/manager/tags_controller.rb~ +54 -0
- data/app/controllers/ish_lib_engine/manager/users_controller.rb +13 -0
- data/app/controllers/ish_lib_engine/manager/users_controller.rb~ +13 -0
- data/app/controllers/ish_lib_engine/manager/welcome_controller.rb +8 -0
- data/app/controllers/ish_lib_engine/manager/welcome_controller.rb~ +9 -0
- data/app/helpers/ish_lib_engine/application_helper.rb +4 -0
- data/app/helpers/ish_lib_engine/articles_helper.rb +4 -0
- data/app/models/ability.rb +152 -0
- data/app/models/ability.rb~ +151 -0
- data/app/models/admin_user.rb +113 -0
- data/app/models/app_model2.rb +33 -0
- data/app/models/auth_token.rb +17 -0
- data/app/models/aux_model.rb +22 -0
- data/app/models/cities_user.rb +17 -0
- data/app/models/city.rb +117 -0
- data/app/models/country.rb +13 -0
- data/app/models/day.rb +21 -0
- data/app/models/decoded_auth_token.rb +6 -0
- data/app/models/event.rb +21 -0
- data/app/models/feature.rb +38 -0
- data/app/models/gallery.rb +59 -0
- data/app/models/ish_lib_engine/article.rb +4 -0
- data/app/models/ish_lib_engine/comment.rb +4 -0
- data/app/models/manager.rb +10 -0
- data/app/models/manager_city.rb +4 -0
- data/app/models/manager_feature.rb +4 -0
- data/app/models/manager_gallery.rb +3 -0
- data/app/models/manager_newsitem.rb +5 -0
- data/app/models/manager_photo.rb +3 -0
- data/app/models/manager_report.rb +4 -0
- data/app/models/manager_site.rb +4 -0
- data/app/models/manager_tag.rb +6 -0
- data/app/models/manager_user.rb +3 -0
- data/app/models/manager_venue.rb +4 -0
- data/app/models/message.rb +14 -0
- data/app/models/newsitem.rb +50 -0
- data/app/models/nodeitem.rb +18 -0
- data/app/models/photo.rb +68 -0
- data/app/models/rate_me.rb +13 -0
- data/app/models/report.rb +144 -0
- data/app/models/review.rb +4 -0
- data/app/models/site.rb +83 -0
- data/app/models/tag.rb +78 -0
- data/app/models/user.rb +122 -0
- data/app/models/user_profile.rb +20 -0
- data/app/models/venue.rb +69 -0
- data/app/models/video.rb +48 -0
- data/app/models/welcome.rb +6 -0
- data/app/models/wikitravel_page.rb +19 -0
- data/app/views/application/_flash_messages.haml +24 -0
- data/app/views/application/_flash_messages.haml~ +24 -0
- data/app/views/ish_lib_engine/articles/_form.html.erb +25 -0
- data/app/views/ish_lib_engine/articles/edit.html.erb +6 -0
- data/app/views/ish_lib_engine/articles/index.html.erb +29 -0
- data/app/views/ish_lib_engine/articles/new.html.erb +5 -0
- data/app/views/ish_lib_engine/articles/show.html.erb +14 -0
- data/app/views/layouts/ish_lib_engine/application.html.erb +14 -0
- data/config/routes.rb +3 -0
- data/db/migrate/20160501041837_create_ish_lib_engine_articles.rb +10 -0
- data/db/migrate/20160501041940_create_ish_lib_engine_comments.rb +10 -0
- data/lib/addressbookitems_tasks.rb +33 -0
- data/lib/cities_tasks.rb +143 -0
- data/lib/core_extensions.rb +21 -0
- data/lib/features_tasks.rb +17 -0
- data/lib/float.rb +14 -0
- data/lib/galleries_tasks.rb +91 -0
- data/lib/ish_lib_engine.rb +4 -0
- data/lib/ish_lib_engine/engine.rb +5 -0
- data/lib/ish_lib_engine/version.rb +3 -0
- data/lib/reports_tasks.rb +53 -0
- data/lib/sitemaps_tasks.rb +108 -0
- data/lib/sites_tasks.rb +31 -0
- data/lib/string.rb +15 -0
- data/lib/tags_tasks.rb +104 -0
- data/lib/tasks/cities.rake +29 -0
- data/lib/tasks/galleries.rake +19 -0
- data/lib/tasks/ish_lib_engine_tasks.rake +4 -0
- data/lib/tasks/reports.rake +37 -0
- data/lib/tasks/resque.rake +8 -0
- data/lib/tasks/sitemaps.rake +12 -0
- data/lib/tasks/sites.rake +12 -0
- data/lib/tasks/tags.rake +17 -0
- data/lib/tasks/users.rake +14 -0
- data/lib/tasks/venues.rake +13 -0
- data/lib/tasks/videos.rake +18 -0
- data/lib/tasks/wikitravel_pages.rake +40 -0
- data/lib/test_extensions.rb +9 -0
- data/lib/u.rb +34 -0
- data/lib/users_tasks.rb +88 -0
- data/lib/venues_tasks.rb +15 -0
- data/lib/videos_tasks.rb +71 -0
- data/lib/wikitravel_tasks.rb +139 -0
- data/spec/factories/cities.rb +89 -0
- data/spec/factories/galleries.rb +133 -0
- data/spec/factories/photo.rb +20 -0
- data/spec/factories/reports.rb +379 -0
- data/spec/factories/site.rb +26 -0
- data/spec/factories/tag.rb +42 -0
- data/spec/factories/user.rb +87 -0
- data/spec/factories/user_profiles.rb +33 -0
- data/spec/factories/venues.rb +25 -0
- data/spec/factories/videos.rb +38 -0
- data/test/controllers/ish_lib_engine/articles_controller_test.rb +52 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +30 -0
- data/test/dummy/log/development.log +15 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/fixtures/ish_lib_engine/articles.yml +9 -0
- data/test/fixtures/ish_lib_engine/comments.yml +9 -0
- data/test/integration/navigation_test.rb +8 -0
- data/test/ish_lib_engine_test.rb +7 -0
- data/test/models/ish_lib_engine/article_test.rb +9 -0
- data/test/models/ish_lib_engine/comment_test.rb +9 -0
- data/test/test_helper.rb +21 -0
- metadata +361 -0
data/app/models/user.rb
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
|
2
|
+
class User
|
3
|
+
include Mongoid::Document
|
4
|
+
include Mongoid::Timestamps
|
5
|
+
|
6
|
+
# Setup accessible (or protected) attributes for your model
|
7
|
+
# attr_accessible :email, :password, :password_confirmation, :remember_me
|
8
|
+
|
9
|
+
## Database authenticatable
|
10
|
+
field :email, type: String, default: ""
|
11
|
+
validates :email, :presence => true, :uniqueness => true
|
12
|
+
|
13
|
+
field :encrypted_password, type: String, default: ""
|
14
|
+
|
15
|
+
## Recoverable
|
16
|
+
field :reset_password_token, type: String
|
17
|
+
field :reset_password_sent_at, type: Time
|
18
|
+
|
19
|
+
## Rememberable
|
20
|
+
field :remember_created_at, type: Time
|
21
|
+
|
22
|
+
## Trackable
|
23
|
+
field :sign_in_count, type: Integer, default: 0
|
24
|
+
field :current_sign_in_at, type: Time
|
25
|
+
field :last_sign_in_at, type: Time
|
26
|
+
field :current_sign_in_ip, type: String
|
27
|
+
field :last_sign_in_ip, type: String
|
28
|
+
|
29
|
+
## Confirmable
|
30
|
+
# field :confirmation_token, type: String
|
31
|
+
# field :confirmed_at, type: Time
|
32
|
+
# field :confirmation_sent_at, type: Time
|
33
|
+
# field :unconfirmed_email, type: String # Only if using reconfirmable
|
34
|
+
|
35
|
+
## Lockable
|
36
|
+
# field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
|
37
|
+
# field :unlock_token, type: String # Only if unlock strategy is :email or :both
|
38
|
+
# field :locked_at, type: Time
|
39
|
+
|
40
|
+
# :recoverable, :trackable :rememberable,
|
41
|
+
# :token_authenticatable,
|
42
|
+
# :lockable, :timeoutable, :confirmable
|
43
|
+
devise :registerable, :validatable
|
44
|
+
devise :database_authenticatable, :authentication_keys => [ :email ]
|
45
|
+
# devise :omniauthable, :omniauth_providers => [ :facebook ]
|
46
|
+
# devise :encryptable, :encryptor => :sha1base64
|
47
|
+
#
|
48
|
+
#
|
49
|
+
# field :confirmed_at, :type => DateTime
|
50
|
+
# field :confirmation_token, :type => String
|
51
|
+
# field :confirmation_sent_at, :type => DateTime
|
52
|
+
|
53
|
+
field :username, :type => String
|
54
|
+
validates :username, :presence => true, :uniqueness => true
|
55
|
+
|
56
|
+
field :name, :type => String
|
57
|
+
validates :name, :presence => true
|
58
|
+
|
59
|
+
field :group_id, :type => Integer, :default => 3
|
60
|
+
|
61
|
+
field :scratchpad, :type => String
|
62
|
+
field :github_path, :type => String
|
63
|
+
field :facebook_path, :type => String
|
64
|
+
field :stackoverflow_path, :type => String
|
65
|
+
|
66
|
+
field :is_feature, :type => Boolean, :default => false
|
67
|
+
field :is_trash, :type => Boolean, :default => false
|
68
|
+
|
69
|
+
field :display_ads, :type => Boolean, :default => true
|
70
|
+
field :display_help, :type => Boolean, :default => true
|
71
|
+
|
72
|
+
has_many :reports
|
73
|
+
has_many :photos
|
74
|
+
has_many :user_profiles
|
75
|
+
has_many :galleries
|
76
|
+
has_many :videos
|
77
|
+
|
78
|
+
has_one :profile_photo, :class_name => 'Photo', :inverse_of => :profile_user
|
79
|
+
|
80
|
+
has_and_belongs_to_many :viewable_photos, :class_name => 'Photo', :inverse_of => :viewer
|
81
|
+
|
82
|
+
belongs_to :guide_city, :class_name => 'City', :inverse_of => :guide
|
83
|
+
belongs_to :current_city, :class_name => 'City', :inverse_of => :city_users
|
84
|
+
|
85
|
+
def self.list conditions = { :is_trash => false }
|
86
|
+
out = self.where( conditions ).order_by( :name => :asc )
|
87
|
+
[['', nil]] + out.map { |item| [ item.name, item.id ] }
|
88
|
+
end
|
89
|
+
|
90
|
+
embeds_many :newsitems
|
91
|
+
|
92
|
+
def self.all
|
93
|
+
self.where( :is_trash => false ).order_by( :created_at => :desc )
|
94
|
+
end
|
95
|
+
|
96
|
+
def create_newsitem args = {}
|
97
|
+
unless args[:photo].blank?
|
98
|
+
n = Newsitem.new
|
99
|
+
n.photo = args[:photo]
|
100
|
+
n.descr = 'uploaded new photo on'
|
101
|
+
n.username = self.username
|
102
|
+
self.newsitems << n
|
103
|
+
self.save
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.per_page
|
108
|
+
16
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.clear
|
112
|
+
if Rails.env.test?
|
113
|
+
User.unscoped.each { |u| u.remove }
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def generate_auth_token
|
118
|
+
payload = { user_id: self.id }
|
119
|
+
AuthToken.encode(payload)
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
class UserProfile
|
3
|
+
|
4
|
+
include Mongoid::Document
|
5
|
+
include Mongoid::Timestamps
|
6
|
+
|
7
|
+
field :about, :type => String
|
8
|
+
field :education, :type => String
|
9
|
+
field :objectives, :type => String
|
10
|
+
field :current_employment, :type => String
|
11
|
+
field :past_employment, :type => String
|
12
|
+
|
13
|
+
field :pdf_resume_path, :type => String
|
14
|
+
field :doc_resume_path, :type => String
|
15
|
+
|
16
|
+
field :lang, :type => String
|
17
|
+
|
18
|
+
belongs_to :user
|
19
|
+
|
20
|
+
end
|
data/app/models/venue.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
|
2
|
+
require 'string'
|
3
|
+
|
4
|
+
class Venue
|
5
|
+
|
6
|
+
include Mongoid::Document
|
7
|
+
include Mongoid::Timestamps
|
8
|
+
|
9
|
+
field :name, :type => String
|
10
|
+
validates :name, :uniqueness => true, :allow_nil => false
|
11
|
+
|
12
|
+
field :name_seo, :type => String
|
13
|
+
validates :name_seo, :uniqueness => true, :allow_nil => false
|
14
|
+
|
15
|
+
field :descr, :type => String
|
16
|
+
|
17
|
+
field :is_trash, :type => Boolean, :default => false
|
18
|
+
scope :fresh, ->{ where({ :is_trash => false }) }
|
19
|
+
scope :trash, ->{ where({ :is_trash => true }) }
|
20
|
+
|
21
|
+
field :is_public, :type => Boolean, :default => true
|
22
|
+
scope :public, ->{ where({ :is_public => true }) }
|
23
|
+
scope :not_public, ->{ where({ :is_public => false }) }
|
24
|
+
|
25
|
+
field :is_feature, :type => Boolean, :default => false
|
26
|
+
|
27
|
+
field :x, :type => Float
|
28
|
+
field :y, :type => Float
|
29
|
+
|
30
|
+
field :lang, :type => String, :default => 'en'
|
31
|
+
|
32
|
+
belongs_to :city
|
33
|
+
belongs_to :owner, :class_name => 'User', :inverse_of => :owned_venue
|
34
|
+
validates :city, :allow_nil => false, :presence => true
|
35
|
+
|
36
|
+
has_and_belongs_to_many :users
|
37
|
+
|
38
|
+
has_one :profile_photo, :class_name => 'Photo', :inverse_of => :profile_venue
|
39
|
+
|
40
|
+
has_many :reports
|
41
|
+
has_many :galleries
|
42
|
+
has_many :photos
|
43
|
+
|
44
|
+
embeds_many :newsitems
|
45
|
+
embeds_many :features
|
46
|
+
|
47
|
+
def self.list conditions = { :is_trash => false }
|
48
|
+
out = self.where( conditions).order_by( :name => :asc )
|
49
|
+
[['', nil]] + out.map { |item| [ item.name, item.id ] }
|
50
|
+
end
|
51
|
+
|
52
|
+
set_callback(:create, :before) do |doc|
|
53
|
+
doc.name_seo = doc.name.to_simple_string
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.types
|
57
|
+
return []
|
58
|
+
# if 'en' == @locale
|
59
|
+
# [ 'Hotels', 'Restaurants', 'Bars' ]
|
60
|
+
# else
|
61
|
+
# [ 'Hotels', 'Restaurants', 'Bars' ]
|
62
|
+
# end
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.n_features
|
66
|
+
6
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
data/app/models/video.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
|
2
|
+
class Video
|
3
|
+
|
4
|
+
include Mongoid::Document
|
5
|
+
include Mongoid::Timestamps
|
6
|
+
|
7
|
+
PER_PAGE = 6
|
8
|
+
|
9
|
+
field :name, :type => String
|
10
|
+
field :descr, :type => String
|
11
|
+
|
12
|
+
default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) }
|
13
|
+
|
14
|
+
field :is_trash, :type => Boolean, :default => false
|
15
|
+
field :is_public, :type => Boolean, :default => true
|
16
|
+
field :is_feature, :type => Boolean, :default => false
|
17
|
+
|
18
|
+
field :x, :type => Float
|
19
|
+
field :y, :type => Float
|
20
|
+
|
21
|
+
field :lang, :type => String, :default => 'en'
|
22
|
+
|
23
|
+
field :youtube_id, :type => String
|
24
|
+
validates :youtube_id, :uniqueness => true, :presence => true
|
25
|
+
|
26
|
+
belongs_to :tag
|
27
|
+
belongs_to :city
|
28
|
+
belongs_to :site
|
29
|
+
validates :site, :presence => true
|
30
|
+
belongs_to :user
|
31
|
+
validates :user, :presence => true
|
32
|
+
|
33
|
+
accepts_nested_attributes_for :site, :tag, :city
|
34
|
+
|
35
|
+
|
36
|
+
def self.list
|
37
|
+
[['', nil]] + Video.all.order_by( :name => :desc ).map { |item| [ item.name, item.id ] }
|
38
|
+
end
|
39
|
+
|
40
|
+
set_callback( :create, :before ) do |doc|
|
41
|
+
if doc.is_public
|
42
|
+
doc.city.add_newsitem( doc ) unless doc.city.blank?
|
43
|
+
doc.site.add_newsitem( doc ) unless doc.site.blank?
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class WikitravelPage
|
2
|
+
include Mongoid::Document
|
3
|
+
include Mongoid::Timestamps
|
4
|
+
|
5
|
+
field :title, :type => String
|
6
|
+
validates :title, :presence => true, :uniqueness => true
|
7
|
+
|
8
|
+
field :url, :type => String
|
9
|
+
validates :url, :presence => true, :uniqueness => true
|
10
|
+
|
11
|
+
def self.clear
|
12
|
+
if Rails.env.test?
|
13
|
+
self.each { |r| r.remove }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
DOMAIN = 'http://wikitravel.org'
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
.a
|
3
|
+
.b
|
4
|
+
.c
|
5
|
+
.d
|
6
|
+
- if flash[:notice]
|
7
|
+
%br
|
8
|
+
.callout{ 'data-closable' => '' }
|
9
|
+
= flash[:notice]
|
10
|
+
%button.close-button{ 'aria-label' => 'Dismiss alert', :type => 'button', 'data-close' => '' }
|
11
|
+
%span{ 'aria-hidden' => 'true' } ×
|
12
|
+
- if flash[:error]
|
13
|
+
%br
|
14
|
+
.callout.alert{ 'data-closable' => '' }
|
15
|
+
= flash[:error]
|
16
|
+
%button.close-button{ 'aria-label' => 'Dismiss alert', :type => 'button', 'data-close' => '' }
|
17
|
+
%span{ 'aria-hidden' => 'true' } ×
|
18
|
+
- if flash[:alert] # cancan does this
|
19
|
+
%br
|
20
|
+
.callout.alert{ 'data-closable' => '' }
|
21
|
+
= flash[:alert]
|
22
|
+
%button.close-button{ 'aria-label' => 'Dismiss alert', :type => 'button', 'data-close' => '' }
|
23
|
+
%span{ 'aria-hidden' => 'true' } ×
|
24
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
.a
|
3
|
+
.b
|
4
|
+
.c
|
5
|
+
.d
|
6
|
+
- if flash[:notice]
|
7
|
+
%br
|
8
|
+
.callout{ 'data-closable' => '' }
|
9
|
+
= flash[:notice]
|
10
|
+
%button.close-button{ 'aria-label' => 'Dismiss alert', :type => 'button', 'data-close' => '' }
|
11
|
+
%span{ 'aria-hidden' => 'true' } ×
|
12
|
+
- if flash[:error]
|
13
|
+
%br
|
14
|
+
.callout.alert{ 'data-closable' => '' }
|
15
|
+
= flash[:error]
|
16
|
+
%button.close-button{ 'aria-label' => 'Dismiss alert', :type => 'button', 'data-close' => '' }
|
17
|
+
%span{ 'aria-hidden' => 'true' } ×
|
18
|
+
- if flash[:alert] # cancan does this
|
19
|
+
%br
|
20
|
+
.callout.alert{ 'data-closable' => '' }
|
21
|
+
= flash[:alert]
|
22
|
+
%button.close-button{ 'aria-label' => 'Dismiss alert', :type => 'button', 'data-close' => '' }
|
23
|
+
%span{ 'aria-hidden' => 'true' } ×
|
24
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%= form_for(@article) do |f| %>
|
2
|
+
<% if @article.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@article.errors.count, "error") %> prohibited this article from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @article.errors.full_messages.each do |message| %>
|
8
|
+
<li><%= message %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :title %><br>
|
16
|
+
<%= f.text_field :title %>
|
17
|
+
</div>
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :body %><br>
|
20
|
+
<%= f.text_area :body %>
|
21
|
+
</div>
|
22
|
+
<div class="actions">
|
23
|
+
<%= f.submit %>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<h1>Listing Articles</h1>
|
4
|
+
|
5
|
+
<table>
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th>Title</th>
|
9
|
+
<th>Body</th>
|
10
|
+
<th colspan="3"></th>
|
11
|
+
</tr>
|
12
|
+
</thead>
|
13
|
+
|
14
|
+
<tbody>
|
15
|
+
<% @articles.each do |article| %>
|
16
|
+
<tr>
|
17
|
+
<td><%= article.title %></td>
|
18
|
+
<td><%= article.body %></td>
|
19
|
+
<td><%= link_to 'Show', article %></td>
|
20
|
+
<td><%= link_to 'Edit', edit_article_path(article) %></td>
|
21
|
+
<td><%= link_to 'Destroy', article, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
</tbody>
|
25
|
+
</table>
|
26
|
+
|
27
|
+
<br>
|
28
|
+
|
29
|
+
<%= link_to 'New Article', new_article_path %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<strong>Title:</strong>
|
5
|
+
<%= @article.title %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<strong>Body:</strong>
|
10
|
+
<%= @article.body %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<%= link_to 'Edit', edit_article_path(@article) %> |
|
14
|
+
<%= link_to 'Back', articles_path %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>IshLibEngine</title>
|
5
|
+
<%= stylesheet_link_tag "ish_lib_engine/application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "ish_lib_engine/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|