ish_manager 0.1.8.252 → 0.1.8.253
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/ish_manager/{application.css → application.scss} +84 -93
- data/app/assets/stylesheets/ish_manager/maps.scss +0 -1
- data/app/controllers/ish_manager/application_controller.rb +5 -5
- data/app/controllers/ish_manager/features_controller.rb +7 -7
- data/app/controllers/ish_manager/maps_controller.rb +2 -2
- data/app/controllers/ish_manager/newsitems_controller.rb +57 -96
- data/app/controllers/ish_manager/reports_controller.rb +39 -71
- data/app/controllers/ish_manager/tags_controller.rb +40 -37
- data/app/controllers/ish_manager/user_profiles_controller.rb +3 -1
- data/app/views/ish_manager/application/_main_footer.haml +3 -3
- data/app/views/ish_manager/application/_main_header.haml +1 -1
- data/app/views/ish_manager/application/_main_header_admin.haml +34 -39
- data/app/views/ish_manager/application/_main_header_guy.haml +1 -1
- data/app/views/ish_manager/application/_main_header_manager.haml +1 -1
- data/app/views/ish_manager/cities/_form.haml +5 -5
- data/app/views/ish_manager/cities/edit_feature.haml +1 -1
- data/app/views/ish_manager/cities/index.haml +2 -2
- data/app/views/ish_manager/cities/show.haml +15 -15
- data/app/views/ish_manager/events/_form.haml +7 -7
- data/app/views/ish_manager/features/_form.haml +6 -6
- data/app/views/ish_manager/features/_index.haml +42 -28
- data/app/views/ish_manager/features/_index.haml-trash +36 -0
- data/app/views/ish_manager/features/_item.haml +1 -1
- data/app/views/ish_manager/features/index.haml +4 -25
- data/app/views/ish_manager/galleries/_form.haml +15 -15
- data/app/views/ish_manager/galleries/_index_thumbs.haml +1 -1
- data/app/views/ish_manager/galleries/_menu.haml +1 -1
- data/app/views/ish_manager/galleries/_thumbs.haml +1 -1
- data/app/views/ish_manager/galleries/_title.haml +1 -1
- data/app/views/ish_manager/galleries/show.haml +3 -3
- data/app/views/ish_manager/invoices/index.haml +1 -1
- data/app/views/ish_manager/invoices/new.haml +1 -1
- data/app/views/ish_manager/leads/new.haml +1 -1
- data/app/views/ish_manager/maps/_form.haml +13 -5
- data/app/views/ish_manager/maps/_index_item.haml +7 -0
- data/app/views/ish_manager/maps/_map_meta_row.haml +0 -1
- data/app/views/ish_manager/maps/index.haml +5 -3
- data/app/views/ish_manager/maps/show.haml +1 -4
- data/app/views/ish_manager/markers/_form.haml +16 -16
- data/app/views/ish_manager/newsitems/_form.haml +45 -35
- data/app/views/ish_manager/newsitems/_index.haml +23 -34
- data/app/views/ish_manager/newsitems/_item.haml +3 -3
- data/app/views/ish_manager/newsitems/edit.haml +11 -10
- data/app/views/ish_manager/reports/_form.haml +24 -14
- data/app/views/ish_manager/reports/_index.haml +1 -1
- data/app/views/ish_manager/reports/new.haml +1 -1
- data/app/views/ish_manager/reports/show.haml +2 -1
- data/app/views/ish_manager/sites/_header.haml +8 -3
- data/app/views/ish_manager/sites/galleries.haml +1 -1
- data/app/views/ish_manager/sites/index.haml +1 -1
- data/app/views/ish_manager/sites/show.haml +4 -4
- data/app/views/ish_manager/stock_watches/_form.haml +1 -1
- data/app/views/ish_manager/tags/_features.haml +2 -2
- data/app/views/ish_manager/tags/_form.haml +12 -16
- data/app/views/ish_manager/tags/_list.haml +1 -1
- data/app/views/ish_manager/tags/_list_simple.haml +1 -1
- data/app/views/ish_manager/tags/_meta.haml +9 -0
- data/app/views/ish_manager/tags/edit.haml +1 -1
- data/app/views/ish_manager/tags/show.haml +8 -12
- data/app/views/ish_manager/user_profiles/_form.haml +2 -2
- data/app/views/ish_manager/user_profiles/index.haml +3 -4
- data/app/views/ish_manager/user_profiles/new.haml +1 -1
- data/app/views/ish_manager/venues/_form.haml +14 -14
- data/app/views/ish_manager/venues/_index.haml +1 -1
- data/app/views/ish_manager/videos/_form.haml +8 -8
- data/app/views/ish_manager/videos/_index.haml +4 -3
- data/app/views/ish_manager/videos/_index_title.haml +2 -2
- data/app/views/layouts/ish_manager/application.haml +1 -1
- data/app/views/layouts/ish_manager/application_no_materialize.haml +2 -2
- data/config/routes.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f22a877e38fa81c26881bef942e43cef7f203b84aeb78867478b46e1e215d0e9
|
4
|
+
data.tar.gz: d40cd5edbdb7bd40024f2de398f9b37b8d9df25da62f187b7ac67f28b637945f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fa6e95114f3f01275e8cfe1567ba98d42ccc7b1e8edf7c85b7fb89cf1357559dbe8f4f73ef7411475872b0f342d38f4c90278e6133ace095f341008d13274d8
|
7
|
+
data.tar.gz: 6d4b9633e0e8de2ad33b0351affeca4ab4360cfc616ff34474183713e2ea4506b26e3fcf597b632efe0d8ccdff9feb0b1904c1d4ba52bbd08a5acd669d1d0728
|
@@ -10,8 +10,6 @@
|
|
10
10
|
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
11
|
* It is generally better to create a new file per style scope.
|
12
12
|
*
|
13
|
-
*= require ish_manager/bootstrap
|
14
|
-
*= require ish_manager/reset
|
15
13
|
*= require_self
|
16
14
|
*= require ish_manager/tags
|
17
15
|
*= require ish_manager/maps
|
@@ -22,49 +20,62 @@
|
|
22
20
|
*= require ish_manager/user_profiles
|
23
21
|
*/
|
24
22
|
|
23
|
+
body {
|
24
|
+
background: #dedede;
|
25
|
+
font-size: 20px;
|
26
|
+
}
|
25
27
|
|
26
28
|
/**
|
27
29
|
* utils
|
28
30
|
*/
|
31
|
+
|
32
|
+
/* A */
|
33
|
+
|
34
|
+
.addToggle + * {
|
35
|
+
display: none;
|
36
|
+
}
|
37
|
+
.alert {
|
38
|
+
boroder: 1px solid yellow;
|
39
|
+
padding: .8em;
|
40
|
+
}
|
41
|
+
|
42
|
+
/* B */
|
43
|
+
|
29
44
|
.bg-white {
|
30
45
|
background: url('/assets/bg/confectionary.png');
|
31
46
|
padding-bottom: 1em;
|
32
47
|
}
|
33
48
|
|
34
|
-
|
35
|
-
background: #
|
49
|
+
.blue {
|
50
|
+
background: #5bc0de;
|
51
|
+
color: white;
|
52
|
+
}
|
53
|
+
|
54
|
+
.border-red {
|
55
|
+
border: 1px solid red;
|
56
|
+
padding: 1em;
|
36
57
|
}
|
37
58
|
|
59
|
+
/* C */
|
60
|
+
|
38
61
|
.center {
|
39
62
|
text-align: center;
|
40
63
|
}
|
41
64
|
|
42
|
-
.
|
43
|
-
|
65
|
+
.clearfix {
|
66
|
+
clear: both;
|
44
67
|
}
|
45
68
|
|
46
|
-
.
|
47
|
-
|
48
|
-
padding: .8em;
|
49
|
-
}
|
50
|
-
.alert {
|
51
|
-
boroder: 1px solid yellow;
|
52
|
-
padding: .8em;
|
69
|
+
.collapse-expand {
|
70
|
+
cursor: pointer;
|
53
71
|
}
|
54
72
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
}
|
73
|
+
/* D */
|
74
|
+
/* E */
|
75
|
+
/* F */
|
59
76
|
|
60
|
-
.
|
61
|
-
|
62
|
-
border: 1px solid red;
|
63
|
-
width: 100px;
|
64
|
-
height: 100px;
|
65
|
-
}
|
66
|
-
.large-photos img {
|
67
|
-
width: 100%;
|
77
|
+
.flex-row {
|
78
|
+
display: flex;
|
68
79
|
}
|
69
80
|
|
70
81
|
.float-left {
|
@@ -74,40 +85,31 @@ hr {
|
|
74
85
|
.float-right {
|
75
86
|
float: right;
|
76
87
|
}
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
.blue {
|
81
|
-
background: #5bc0de;
|
82
|
-
color: white;
|
83
|
-
}
|
84
|
-
|
85
|
-
.panel-content {
|
86
|
-
padding: .5em;
|
88
|
+
hr {
|
89
|
+
background: red;
|
90
|
+
height: 1px !important;
|
87
91
|
}
|
88
92
|
|
89
|
-
|
90
|
-
cursor: pointer;
|
91
|
-
}
|
93
|
+
/* I */
|
92
94
|
|
93
|
-
.
|
94
|
-
|
95
|
+
.inline {
|
96
|
+
display: inline-block;
|
95
97
|
}
|
96
|
-
|
97
98
|
ul.inline li {
|
98
99
|
display: inline;
|
99
100
|
}
|
100
101
|
|
101
|
-
|
102
|
-
.
|
103
|
-
|
104
|
-
padding: 1em;
|
102
|
+
/* L */
|
103
|
+
textarea.large {
|
104
|
+
height: 400px;
|
105
105
|
}
|
106
106
|
|
107
|
-
.
|
108
|
-
|
107
|
+
.large-photos img {
|
108
|
+
width: 100%;
|
109
109
|
}
|
110
110
|
|
111
|
+
/* M */
|
112
|
+
|
111
113
|
.menu-secondary {}
|
112
114
|
.menu-secondary li {
|
113
115
|
display: inline;
|
@@ -117,12 +119,47 @@ ul.inline li {
|
|
117
119
|
background: white;
|
118
120
|
}
|
119
121
|
|
122
|
+
.panel-content {
|
123
|
+
padding: .5em;
|
124
|
+
}
|
125
|
+
.thumb {
|
126
|
+
background: dedede;
|
127
|
+
border: 1px solid red;
|
128
|
+
width: 100px;
|
129
|
+
height: 100px;
|
130
|
+
}
|
131
|
+
ul.inline li {
|
132
|
+
padding-right: 1em;
|
133
|
+
}
|
134
|
+
|
135
|
+
.notice {
|
136
|
+
border: 1px solid green;
|
137
|
+
padding: .8em;
|
138
|
+
}
|
139
|
+
|
140
|
+
.youtube_img {
|
141
|
+
width: 100px;
|
142
|
+
}
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
120
151
|
/**
|
121
152
|
* manager...
|
122
153
|
*/
|
123
154
|
|
124
155
|
.manager--main-header {
|
125
156
|
background: url('/assets/bg/weather.png');
|
157
|
+
ul {
|
158
|
+
li {
|
159
|
+
display: inline;
|
160
|
+
padding: 1em;
|
161
|
+
}
|
162
|
+
}
|
126
163
|
}
|
127
164
|
.manager--main-header hr {
|
128
165
|
margin-top: 0;
|
@@ -138,17 +175,6 @@ ul.inline li {
|
|
138
175
|
border-bottom: 1px solid red;
|
139
176
|
}
|
140
177
|
|
141
|
-
/**
|
142
|
-
* pagination
|
143
|
-
*/
|
144
|
-
|
145
|
-
/* nav.pagination {
|
146
|
-
padding-left: 1em;
|
147
|
-
background: transparent;
|
148
|
-
}
|
149
|
-
nav.pagination
|
150
|
-
*/
|
151
|
-
|
152
178
|
|
153
179
|
/**
|
154
180
|
* reports
|
@@ -161,41 +187,6 @@ nav.pagination
|
|
161
187
|
}
|
162
188
|
|
163
189
|
|
164
|
-
/**
|
165
|
-
* ally, stock watches
|
166
|
-
*/
|
167
|
-
.price {
|
168
|
-
/* margin-left: 1em; */
|
169
|
-
}
|
170
|
-
.descriptive {
|
171
|
-
line-height: 2em;
|
172
|
-
}
|
173
|
-
.price::before {
|
174
|
-
content: "$";
|
175
|
-
position: absolute;
|
176
|
-
top: 1em;
|
177
|
-
left: 0;
|
178
|
-
}
|
179
|
-
table.stock_watches td {
|
180
|
-
border-right: 1px solid cyan;
|
181
|
-
padding: 15px;
|
182
|
-
}
|
183
|
-
table.stock_watches .trashy {
|
184
|
-
background: #cecece;
|
185
|
-
}
|
186
|
-
|
187
|
-
.stock-option {
|
188
|
-
/* border: 1px solid red; */
|
189
|
-
border-radius: 5px;
|
190
|
-
display: inline-block;
|
191
|
-
padding: 5px;
|
192
|
-
box-shadow: 2px 2px 5px grey;
|
193
|
-
margin: 5px;
|
194
|
-
}
|
195
|
-
.stock-option:hover {
|
196
|
-
box-shadow: 3px 3px 5px grey;
|
197
|
-
}
|
198
|
-
|
199
190
|
/*
|
200
191
|
* newsitems
|
201
192
|
*/
|
@@ -26,15 +26,15 @@ module IshManager
|
|
26
26
|
|
27
27
|
def set_lists
|
28
28
|
@cities_list = City.list
|
29
|
+
@galleries_list = Gallery.all.list
|
29
30
|
@locations_list = ::Gameui::Map.list
|
31
|
+
@maps_list = ::Gameui::Map.list
|
32
|
+
@reports_list = Report.all.list
|
30
33
|
@sites_list = Site.all.list
|
34
|
+
@tags_list = Tag.list
|
35
|
+
@user_profiles_list = IshModels::UserProfile.all.list
|
31
36
|
@venues_list = Venue.all.list
|
32
|
-
|
33
|
-
@reports_list = Report.all.list
|
34
|
-
@galleries_list = Gallery.all.list
|
35
37
|
@videos_list = Video.all.list
|
36
|
-
@user_profiles_list = IshModels::UserProfile.all.list
|
37
|
-
@tags_list = Tag.list
|
38
38
|
end
|
39
39
|
|
40
40
|
def access_denied exception
|
@@ -2,7 +2,7 @@
|
|
2
2
|
class IshManager::FeaturesController < IshManager::ApplicationController
|
3
3
|
|
4
4
|
before_action :set_lists
|
5
|
-
|
5
|
+
|
6
6
|
def new
|
7
7
|
if params[:city_id]
|
8
8
|
@city = City.find params[:city_id]
|
@@ -70,7 +70,7 @@ class IshManager::FeaturesController < IshManager::ApplicationController
|
|
70
70
|
@feature = @tag.features.find params[:id]
|
71
71
|
authorize! :edit_feature, @tag
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
74
|
if params[:venue_id]
|
75
75
|
@venue = Tag.find params[:venue_id]
|
76
76
|
@feature = @venue.features.find params[:id]
|
@@ -81,13 +81,13 @@ class IshManager::FeaturesController < IshManager::ApplicationController
|
|
81
81
|
|
82
82
|
def update
|
83
83
|
unless params[:city_id].blank?
|
84
|
-
@city = City.find params[:city_id]
|
84
|
+
@city = City.find params[:city_id]
|
85
85
|
authorize! :update_feature, @city
|
86
86
|
@feature = @city.features.find params[:id]
|
87
87
|
redirect_path = city_path( @city )
|
88
88
|
end
|
89
89
|
unless params[:site_id].blank?
|
90
|
-
@site = Site.find params[:site_id]
|
90
|
+
@site = Site.find params[:site_id]
|
91
91
|
authorize! :update_feature, @site
|
92
92
|
@feature = @site.features.find params[:id]
|
93
93
|
redirect_path = site_path( @site )
|
@@ -98,7 +98,7 @@ class IshManager::FeaturesController < IshManager::ApplicationController
|
|
98
98
|
@feature = @tag.features.find params[:id]
|
99
99
|
redirect_path = tag_path( @tag )
|
100
100
|
end
|
101
|
-
|
101
|
+
|
102
102
|
authorize! :update, @feature
|
103
103
|
|
104
104
|
if @feature.update_attributes params[:feature].permit!
|
@@ -111,7 +111,7 @@ class IshManager::FeaturesController < IshManager::ApplicationController
|
|
111
111
|
else
|
112
112
|
flash[:alert] = 'No Luck. ' + @feature.errors.messages
|
113
113
|
render :action => :edit
|
114
|
-
end
|
114
|
+
end
|
115
115
|
end
|
116
116
|
|
117
117
|
def index
|
@@ -145,6 +145,6 @@ class IshManager::FeaturesController < IshManager::ApplicationController
|
|
145
145
|
end
|
146
146
|
redirect_to request.referrer
|
147
147
|
end
|
148
|
-
|
148
|
+
|
149
149
|
end
|
150
150
|
|
@@ -5,8 +5,8 @@ class IshManager::MapsController < IshManager::ApplicationController
|
|
5
5
|
|
6
6
|
def index
|
7
7
|
authorize! :index, ::Gameui::Map
|
8
|
-
@maps = ::Gameui::Map.where( parent_slug: "" )
|
9
|
-
@all_maps = Gameui::Map.all
|
8
|
+
@maps = ::Gameui::Map.where( parent_slug: "" ).order( slug: :asc )
|
9
|
+
@all_maps = Gameui::Map.all.order( slug: :asc )
|
10
10
|
end
|
11
11
|
|
12
12
|
def show
|
@@ -1,28 +1,7 @@
|
|
1
1
|
class IshManager::NewsitemsController < IshManager::ApplicationController
|
2
2
|
before_action :set_lists
|
3
3
|
|
4
|
-
|
5
|
-
@newsitem = Newsitem.new
|
6
|
-
|
7
|
-
@cities_list = City.list
|
8
|
-
@maps_list = ::Gameui::Map.list
|
9
|
-
@sites_list = Site.list
|
10
|
-
@tags_list = Tag.list
|
11
|
-
|
12
|
-
if params[:city_id]
|
13
|
-
@city = City.find params[:city_id]
|
14
|
-
@newsitem.city = @city
|
15
|
-
end
|
16
|
-
if params[:site_id]
|
17
|
-
@site = Site.find params[:site_id]
|
18
|
-
@newsitem.site = @site
|
19
|
-
end
|
20
|
-
if params[:tag_id]
|
21
|
-
@tag = Tag.unscoped.find params[:tag_id]
|
22
|
-
@newsitem.tag = @tag
|
23
|
-
end
|
24
|
-
authorize! :new, @newsitem
|
25
|
-
end
|
4
|
+
## Alphabetized : )
|
26
5
|
|
27
6
|
def create
|
28
7
|
@newsitem = Newsitem.new params[:newsitem].permit!
|
@@ -35,6 +14,7 @@ class IshManager::NewsitemsController < IshManager::ApplicationController
|
|
35
14
|
@resource ||= IshModels::UserProfile.find params[:newsitem][:user_profile_id] if !params[:newsitem][:user_profile_id].blank?
|
36
15
|
@resource ||= ::Gameui::Map.find params[:newsitem][:map_id] if !params[:newsitem][:map_id].blank?
|
37
16
|
@resource.newsitems << @newsitem
|
17
|
+
@resource.touch
|
38
18
|
|
39
19
|
authorize! :create_newsitem, @resource
|
40
20
|
|
@@ -46,13 +26,13 @@ class IshManager::NewsitemsController < IshManager::ApplicationController
|
|
46
26
|
url = case @resource.class.name
|
47
27
|
when "City"
|
48
28
|
edit_city_path( @resource.id )
|
29
|
+
when "IshModels::UserProfile"
|
30
|
+
user_profiles_path
|
31
|
+
when "Site"
|
32
|
+
edit_site_path( @resource.id )
|
49
33
|
when "Tag"
|
50
34
|
@resource.site.touch
|
51
35
|
tag_path( @resource.id )
|
52
|
-
when "Site"
|
53
|
-
edit_site_path( @resource.id )
|
54
|
-
when "IshModels::UserProfile"
|
55
|
-
user_profiles_path
|
56
36
|
else
|
57
37
|
root_path
|
58
38
|
end
|
@@ -72,103 +52,84 @@ class IshManager::NewsitemsController < IshManager::ApplicationController
|
|
72
52
|
end
|
73
53
|
|
74
54
|
def destroy
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
55
|
+
@newsitem = Newsitem.find params[:id]
|
56
|
+
authorize! :destroy, @newsitem
|
57
|
+
|
58
|
+
if @newsitem.destroy
|
59
|
+
City.find(@newsitem.city_id).touch if @newsitem.city_id
|
60
|
+
Site.find(@newsitem.site_id).touch if @newsitem.site_id
|
61
|
+
Tag.find(@newsitem.tag_id).touch if @newsitem.tag_id
|
62
|
+
|
63
|
+
flash[:notice] = "Destroyed the newsitem."
|
64
|
+
else
|
65
|
+
flash[:alert] = "Cannot destroy the newsitem: #{@newsitem.errors.full_messages}."
|
79
66
|
end
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
67
|
+
|
68
|
+
redirect_to request.referrer ? request.referrer : '/'
|
69
|
+
end
|
70
|
+
|
71
|
+
def edit
|
72
|
+
@newsitem = Newsitem.find( params[:id] )
|
73
|
+
authorize! :edit, @newsitem
|
74
|
+
|
75
|
+
## @TODO: what on earth is this?
|
76
|
+
out = Gallery.unscoped.where( :is_trash => false, :user_profile => current_user.profile ).order_by( :created_at => :desc )
|
77
|
+
@galleries_list = [['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
def index
|
82
|
+
@resource = Site.find( params[:site_id] ) if params[:site_id]
|
83
|
+
@resource = City.find( params[:site_id] ) if params[:city_id]
|
84
|
+
|
85
|
+
authorize! :newsitems_index, @resource
|
86
|
+
@newsitems = @resource.newsitems
|
87
|
+
end
|
88
|
+
|
89
|
+
def new
|
90
|
+
@newsitem = Newsitem.new
|
91
|
+
|
92
|
+
if params[:city_id]
|
93
|
+
@city = City.find params[:city_id]
|
94
|
+
@newsitem.city = @city
|
84
95
|
end
|
85
96
|
if params[:site_id]
|
86
|
-
site = Site.find
|
87
|
-
|
88
|
-
if flag
|
89
|
-
site.touch
|
90
|
-
end
|
91
|
-
url = edit_site_path( params[:site_id] )
|
97
|
+
@site = Site.find params[:site_id]
|
98
|
+
@newsitem.site = @site
|
92
99
|
end
|
93
100
|
if params[:tag_id]
|
94
|
-
tag = Tag.find
|
95
|
-
|
96
|
-
url = tag_path( params[:tag_id] )
|
101
|
+
@tag = Tag.unscoped.find params[:tag_id]
|
102
|
+
@newsitem.tag = @tag
|
97
103
|
end
|
98
|
-
|
99
|
-
flash[:notice] = "Success? #{flag.inspect}"
|
100
|
-
redirect_to request.referrer ? request.referrer : '/'
|
104
|
+
authorize! :new, @newsitem
|
101
105
|
end
|
102
106
|
|
103
107
|
def update
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
if params[:newsitem][:site_id]
|
109
|
-
@site = Site.find params[:newsitem][:site_id]
|
110
|
-
end
|
111
|
-
@site.touch
|
112
|
-
@newsitem = @site.newsitems.find params[:id]
|
113
|
-
url = edit_site_path( @site )
|
114
|
-
end
|
108
|
+
@newsitem = Newsitem.find params[:id]
|
109
|
+
authorize! :update, @newsitem
|
110
|
+
|
111
|
+
## @TODO: re-add site management here, probably.
|
115
112
|
|
116
113
|
if params[:city_id]
|
117
114
|
@city = City.find params[:city_id]
|
118
115
|
@newsitem = @city.newsitems.find params[:id]
|
119
116
|
url = edit_city_path( @city )
|
120
117
|
end
|
118
|
+
|
121
119
|
if params[:photo]
|
122
120
|
photo = Photo.new :photo => params[:photo]
|
123
121
|
photo.user_profile = current_user.profile
|
124
122
|
@newsitem.photo = photo
|
125
123
|
end
|
126
|
-
authorize! :update, @newsitem
|
127
|
-
flag = @newsitem.update_attributes params[:newsitem].permit!
|
128
124
|
|
125
|
+
flag = @newsitem.update_attributes params[:newsitem].permit!
|
129
126
|
if flag
|
130
127
|
flash[:notice] = 'Success'
|
131
128
|
else
|
132
129
|
flash[:alert] = "No Luck: #{@newsitem.errors.messages}"
|
133
130
|
end
|
134
131
|
|
135
|
-
redirect_to
|
136
|
-
end
|
137
|
-
|
138
|
-
def edit
|
139
|
-
out = Gallery.unscoped.where( :is_trash => false, :user_profile => current_user.profile ).order_by( :created_at => :desc )
|
140
|
-
@galleries_list = [['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
|
141
|
-
|
142
|
-
if params[:site_id]
|
143
|
-
@site = Site.find params[:site_id]
|
144
|
-
@newsitem = @site.newsitems.find( params[:id] )
|
145
|
-
end
|
146
|
-
if params[:city_id]
|
147
|
-
@city = City.find params[:city_id]
|
148
|
-
@newsitem = @city.newsitems.find( params[:id] )
|
149
|
-
end
|
150
|
-
authorize! :edit, @newsitem
|
151
|
-
|
152
|
-
end
|
153
|
-
|
154
|
-
def index
|
155
|
-
@resource = Site.find( params[:site_id] ) if params[:site_id]
|
156
|
-
@resource = City.find( params[:site_id] ) if params[:city_id]
|
157
|
-
|
158
|
-
authorize! :newsitems_index, @resource
|
159
|
-
@newsitems = @resource.newsitems
|
160
|
-
end
|
161
|
-
|
162
|
-
private
|
163
|
-
|
164
|
-
def set_lists
|
165
|
-
@videos_list = Video.list
|
166
|
-
@galleries_list = Gallery.list
|
167
|
-
@reports_list = Report.list
|
168
|
-
@sites_list = Site.list
|
169
|
-
@cities_list = City.list
|
170
|
-
@tags_list = Tag.list
|
171
|
-
@user_profiles_list = IshModels::UserProfile.list
|
132
|
+
redirect_to edit_newsitem_path(@newsitem)
|
172
133
|
end
|
173
134
|
|
174
135
|
end
|
@@ -3,11 +3,48 @@ class IshManager::ReportsController < IshManager::ApplicationController
|
|
3
3
|
|
4
4
|
before_action :set_lists
|
5
5
|
|
6
|
+
def create
|
7
|
+
@report = Report.new params[:report].permit!
|
8
|
+
@report.user_profile = current_user.profile # @TODO: this should not be hard-coded
|
9
|
+
authorize! :create, @report
|
10
|
+
|
11
|
+
flag = @report.save
|
12
|
+
respond_to do |format|
|
13
|
+
if flag
|
14
|
+
|
15
|
+
## @TODO: I'm sure there is a better way
|
16
|
+
if params[:report][:photo]
|
17
|
+
photo = Photo.new
|
18
|
+
photo.photo = params[:report][:photo]
|
19
|
+
photo.is_public = @report.is_public
|
20
|
+
photo.is_trash = false
|
21
|
+
photo.report_id = @report.id
|
22
|
+
photo.save
|
23
|
+
end
|
24
|
+
|
25
|
+
format.html do
|
26
|
+
redirect_to report_path(@report), :notice => 'Report was successfully created.'
|
27
|
+
end
|
28
|
+
format.json { render :json => @report, :status => :created, :location => @report } # TODO: remove, I got the api now.
|
29
|
+
else
|
30
|
+
format.html do
|
31
|
+
flash[:alert] = @report.errors.full_messages
|
32
|
+
@tags_list = Tag.all.list
|
33
|
+
@sites_list = Site.all.list
|
34
|
+
@cities_list = City.all.list
|
35
|
+
|
36
|
+
render :action => "new"
|
37
|
+
end
|
38
|
+
format.json { render :json => @report.errors, :status => :unprocessable_entity } # @TODO: remove, right? no api here.
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
6
43
|
def index
|
7
44
|
authorize! :index, Report
|
8
|
-
@reports = Report.unscoped.order_by( :created_at => :desc
|
45
|
+
@reports = Report.unscoped.order_by( :created_at => :desc
|
9
46
|
).where( :is_trash => false, :user_profile => current_user.profile
|
10
|
-
).page( params[:reports_page]
|
47
|
+
).page( params[:reports_page]
|
11
48
|
).per( Report::PER_PAGE )
|
12
49
|
if false === params[:site]
|
13
50
|
@reports = @reports.where( :site_id => nil )
|
@@ -74,76 +111,7 @@ class IshManager::ReportsController < IshManager::ApplicationController
|
|
74
111
|
end
|
75
112
|
end
|
76
113
|
|
77
|
-
def create
|
78
|
-
@report = Report.new params[:report].permit!
|
79
|
-
@report.user_profile = current_user.profile
|
80
|
-
authorize! :create, @report
|
81
|
-
|
82
|
-
@site = Site.where( :id => params[:report][:site_id] ).first
|
83
|
-
@site ||= Site.find_by :domain => 'piousbox.com', :lang => :en
|
84
|
-
|
85
|
-
if @site
|
86
|
-
redirect_path = site_reports_path( @site.id )
|
87
|
-
end
|
88
|
-
if params[:report][:city_id]
|
89
|
-
redirect_path = city_path( params[:report][:city_id] )
|
90
|
-
end
|
91
|
-
|
92
|
-
# @report.user = @current_user || User.where( :username => 'anon' ).first
|
93
|
-
# @report.username = @report.user.username
|
94
|
-
@report[:lang] = @locale
|
95
|
-
@report.name_seo ||= @report.id
|
96
|
-
@report.is_feature = false
|
97
|
-
@report.site = @site
|
98
|
-
|
99
|
-
saved = @report.save
|
100
|
-
|
101
|
-
respond_to do |format|
|
102
|
-
if saved
|
103
|
-
|
104
|
-
if params[:report][:photo]
|
105
|
-
# photo
|
106
|
-
photo = Photo.new
|
107
|
-
photo.photo = params[:report][:photo]
|
108
|
-
# photo.user = @report.user
|
109
|
-
photo.is_public = @report.is_public
|
110
|
-
photo.is_trash = false
|
111
|
-
photo.report_id = @report.id
|
112
|
-
photo.save
|
113
|
-
end
|
114
|
-
|
115
|
-
# for homepage
|
116
|
-
# @TODO: move this to the model
|
117
|
-
if @report.is_public
|
118
|
-
n = Newsitem.new
|
119
|
-
n.report = @report
|
120
|
-
n.descr = @report.subhead
|
121
|
-
# n.user = @report.user
|
122
|
-
@site.newsitems << n
|
123
|
-
@site.touch
|
124
|
-
if @site.save
|
125
|
-
else
|
126
|
-
flash[:alert] = (flash[:alert]||'') + 'City could not be saved (newsitem). '
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
format.html do
|
131
|
-
redirect_to redirect_path, :notice => 'Report was successfully created (but newsitem, no information).'
|
132
|
-
end
|
133
|
-
format.json { render :json => @report, :status => :created, :location => @report }
|
134
|
-
else
|
135
|
-
format.html do
|
136
|
-
flash[:alert] = @report.errors.messages
|
137
|
-
@tags_list = Tag.all.where( :is_public => true ).list
|
138
|
-
@sites_list = Site.all.list
|
139
|
-
@cities_list = City.all.list
|
140
114
|
|
141
|
-
render :action => "new"
|
142
|
-
end
|
143
|
-
format.json { render :json => @report.errors, :status => :unprocessable_entity }
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
115
|
|
148
116
|
end
|
149
117
|
|