Merge lp:~jfb-tempo-consulting/unifield-web/US-7088 into lp:unifield-web

Proposed by jftempo
Status: Merged
Merged at revision: 4996
Proposed branch: lp:~jfb-tempo-consulting/unifield-web/US-7088
Merge into: lp:unifield-web
Diff against target: 319 lines (+190/-8)
7 files modified
addons/openerp/controllers/root.py (+24/-7)
addons/openerp/controllers/templates/index.mako (+82/-1)
addons/openerp/po/messages/fr.po (+20/-0)
addons/openerp/static/css/menu.css (+49/-0)
addons/openerp/widgets/listgrid.py (+11/-0)
addons/openerp/widgets/templates/listgrid/url.mako (+3/-0)
openobject/static/css/jquery.fancybox-1.3.1.css (+1/-0)
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-web/US-7088
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+388059@code.launchpad.net
To post a comment you must log in.
4998. By jftempo

Survey align buttons

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'addons/openerp/controllers/root.py'
--- addons/openerp/controllers/root.py 2018-04-25 09:45:33 +0000
+++ addons/openerp/controllers/root.py 2020-08-06 16:14:57 +0000
@@ -26,7 +26,7 @@
2626
27from openobject.tools import url, expose, redirect27from openobject.tools import url, expose, redirect
28from openobject.tools.ast import literal_eval28from openobject.tools.ast import literal_eval
2929import json
30_MAXIMUM_NUMBER_WELCOME_MESSAGES = 330_MAXIMUM_NUMBER_WELCOME_MESSAGES = 3
3131
32def _cp_on_error():32def _cp_on_error():
@@ -53,7 +53,13 @@
53 if read_result['action_id']:53 if read_result['action_id']:
54 next = '/openerp/home'54 next = '/openerp/home'
5555
56 return self.menu(next=next)56 if rpc.session.has_logged:
57 rpc.session.has_logged = False
58 from_login = True
59 else:
60 from_login = False
61
62 return self.menu(next=next, from_login=from_login)
5763
58 @expose()64 @expose()
59 def home(self):65 def home(self):
@@ -93,7 +99,7 @@
93 """ % (url("/openerp/static/images/loading.gif"))99 """ % (url("/openerp/static/images/loading.gif"))
94100
95 @expose(template="/openerp/controllers/templates/index.mako")101 @expose(template="/openerp/controllers/templates/index.mako")
96 def menu(self, active=None, next=None):102 def menu(self, active=None, next=None, from_login=False):
97 from openerp.widgets import tree_view103 from openerp.widgets import tree_view
98 if next == '/openerp/pref/update_password':104 if next == '/openerp/pref/update_password':
99 # in case the password must be changed, do not do others operations105 # in case the password must be changed, do not do others operations
@@ -168,10 +174,17 @@
168 widgets=None174 widgets=None
169 display_shortcut = False175 display_shortcut = False
170176
171177 main_survey = False
172178 other_surveys = []
179 if from_login:
180 surveys = rpc.RPCProxy('sync_client.survey').get_surveys()
181 if surveys:
182 main_survey = surveys[0]
183 if len(surveys) > 1:
184 other_surveys = surveys[1:]
173 return dict(parents=parents, tools=tools, load_content=(next and next or ''),185 return dict(parents=parents, tools=tools, load_content=(next and next or ''),
174 welcome_messages=rpc.RPCProxy('publisher_warranty.contract').get_last_user_messages(_MAXIMUM_NUMBER_WELCOME_MESSAGES),186 survey=main_survey,
187 other_surveys=json.dumps(other_surveys),
175 show_close_btn=rpc.session.uid == 1,188 show_close_btn=rpc.session.uid == 1,
176 widgets=widgets,189 widgets=widgets,
177 display_shortcut=display_shortcut)190 display_shortcut=display_shortcut)
@@ -181,6 +194,7 @@
181 target = kw.get('target') or '/'194 target = kw.get('target') or '/'
182 if target.startswith('/openerp/do_login'):195 if target.startswith('/openerp/do_login'):
183 target = '/'196 target = '/'
197 rpc.session.has_logged = True
184 raise redirect(target)198 raise redirect(target)
185199
186 @expose(allow_json=True)200 @expose(allow_json=True)
@@ -257,5 +271,8 @@
257 error = e271 error = e
258 return dict(error=error)272 return dict(error=error)
259273
260274 @expose(allow_json=True)
275 def survey_answer(self, answer, survey_id, stat_id):
276 rpc.RPCProxy('sync_client.survey.user').save_answer(answer, survey_id, stat_id)
277 return True
261# vim: ts=4 sts=4 sw=4 si et278# vim: ts=4 sts=4 sw=4 si et
262279
=== modified file 'addons/openerp/controllers/templates/index.mako'
--- addons/openerp/controllers/templates/index.mako 2017-09-20 15:17:48 +0000
+++ addons/openerp/controllers/templates/index.mako 2020-08-06 16:14:57 +0000
@@ -170,12 +170,13 @@
170 </td>170 </td>
171 </tr>171 </tr>
172 % endif172 % endif
173 <% user_locale = cp.locale().language %>
173 <tr>174 <tr>
174 <td id="footer_section" colspan="4">175 <td id="footer_section" colspan="4">
175 <div class="footer-a">176 <div class="footer-a">
176 <p class="one">177 <p class="one">
177 <span>${rpc.session.protocol}://${_("%(user)s", user=rpc.session.loginname)}@${rpc.session.host}:${rpc.session.port}</span>178 <span>${rpc.session.protocol}://${_("%(user)s", user=rpc.session.loginname)}@${rpc.session.host}:${rpc.session.port}</span>
178 <span>${cp.locale()}</span>179 <span>${user_locale}</span>
179 </p>180 </p>
180 <p class="powered">${_("Powered by %(openerp)s ",181 <p class="powered">${_("Powered by %(openerp)s ",
181 openerp="""<a target="_blank" href="http://www.openerp.com/">openerp.com</a>""")|n}</p>182 openerp="""<a target="_blank" href="http://www.openerp.com/">openerp.com</a>""")|n}</p>
@@ -184,5 +185,85 @@
184 </tr>185 </tr>
185 </table>186 </table>
186 </div>187 </div>
188
189
190 % if survey:
191 <div id="survey">
192 <div id="survey_title">${_('We welcome your feedback.')}</div>
193 <div>${_('Help us improve your experience by taking our short survey.')}</div>
194 <div id="survey_name">
195 % if user_locale == 'fr' and survey.get('name_fr'):
196 ${survey.get('name_fr')}
197 % else:
198 ${survey.get('name')}
199 % endif
200 </div>
201 <div class="row">
202 <div class="column"><div class="survey_button" onclick="click_answer('goto')">${_('Go to survey')}</div></div>
203 <div class="column"><div class="survey_button" onclick="click_answer('later')">${_('Answer Later')}</div></div>
204 <div class="column" id="button_never"
205 % if survey['nb_displayed'] < 3:
206 style="display: none"
207 % endif
208 ><div class="survey_button" onclick="click_answer('never')">${_('Do not ask me again')}</div></div>
209 </div>
210 </div>
211 <script type="text/javascript">
212 % if user_locale == 'fr' and survey.get('url_fr'):
213 var survey_url = "${survey.get('url_fr')}";
214 % else:
215 var survey_url = "${survey.get('url_en')}";
216 % endif
217 var survey_stat_id = ${survey['stat_id']};
218 var survey_id = ${survey['id']};
219 var survey_index = 0;
220
221 jQuery('#survey').fancybox({'modal': true, 'height': 250, 'width': 700, 'scrolling': 'no', 'autoDimensions': false, 'autoScale': false});
222
223 jQuery(document).ready(function() {
224 jQuery('#survey').trigger('click');
225 jQuery('#survey').show();
226 jQuery('#survey').unbind('click.fb');
227 })
228
229
230 function click_answer(answer) {
231 if (answer == 'goto') {
232 window.open(survey_url,'_blank');
233 }
234 jQuery.post('/openerp/survey_answer', {'answer': answer, 'survey_id': survey_id, 'stat_id': survey_stat_id});
235 next_survey = false;
236 % if len(other_surveys):
237 var other_surveys = ${other_surveys|n};
238 if (other_surveys.length > survey_index) {
239 jQuery('#survey').hide();
240 next_survey = other_surveys[survey_index];
241 % if user_locale == 'fr':
242 survey_url = next_survey.url_fr||next_survey.url_en;
243 survey_name = next_survey.name_fr||next_survey.name;
244 % else:
245 survey_url = next_survey.url_en;
246 survey_name = next_survey.name;
247 % endif
248 survey_stat_id = next_survey.stat_id;
249 survey_id = next_survey.id;
250 $('#survey_name').html(survey_name);
251 if (next_survey.nb_displayed > 2) {
252 $('#button_never').show();
253 } else {
254 $('#button_never').hide();
255 }
256 survey_index += 1;
257 setTimeout(function(){jQuery('#survey').show()}, 450);
258 }
259 % endif
260
261 if (!next_survey) {
262 jQuery('#survey').hide();
263 jQuery.fancybox.close();
264 }
265 }
266 </script>
267 % endif
187</%def>268</%def>
188269
189270
=== modified file 'addons/openerp/po/messages/fr.po'
--- addons/openerp/po/messages/fr.po 2019-10-09 16:15:16 +0000
+++ addons/openerp/po/messages/fr.po 2020-08-06 16:14:57 +0000
@@ -1830,3 +1830,23 @@
1830msgid "In Progress"1830msgid "In Progress"
1831msgstr "En cours"1831msgstr "En cours"
18321832
1833#: controllers/templates/preferences/index.mako:191
1834msgid "We welcome your feedback."
1835msgstr "Nous apprécions vos remarques"
1836
1837#: controllers/templates/preferences/index.mako:191
1838msgid "Help us improve your experience by taking our short survey."
1839msgstr "Aidez-nous à améliorer votre expérience en répondant à notre court sondage."
1840
1841#: controllers/templates/preferences/index.mako:201
1842msgid "Go to survey"
1843msgstr "Répondre au sondage"
1844
1845#: controllers/templates/preferences/index.mako:202
1846msgid "Answer Later"
1847msgstr "Plus tard"
1848
1849#: controllers/templates/preferences/index.mako:207
1850msgid "Do not ask me again"
1851msgstr "Ne plus demander"
1852
18331853
=== modified file 'addons/openerp/static/css/menu.css'
--- addons/openerp/static/css/menu.css 2018-05-28 13:16:01 +0000
+++ addons/openerp/static/css/menu.css 2020-08-06 16:14:57 +0000
@@ -138,3 +138,52 @@
138 color: #C0C0C0;138 color: #C0C0C0;
139}139}
140140
141#survey {
142 background-color: #5c5cff;
143 color: #ffffff;
144 font-size:20px;
145 text-align: center;
146 height: 250px;
147 display: none;
148}
149
150#survey_title {
151 font-size:35px;
152 padding-top: 10px;
153 margin-bottom: 35px;
154}
155
156#survey .column {
157 display: inline-block;
158 width: 32%;
159 text-align: center;
160}
161
162#survey .survey_button {
163 text-align: center;
164 background-color: white;
165 color: #5c5cff;
166 margin: 5px;
167 cursor: pointer;
168 border-radius: 3px;
169}
170
171#survey .survey_button:hover {
172 background-color: #00A3FF;
173 color: white;
174}
175
176#survey .row {
177 padding-top:25px;
178}
179/* Clear floats after the columns */
180#survey .row:after {
181 content: "";
182 display: table;
183 clear: both;
184}
185
186#survey_name {
187 font-weight: bold;
188 margin-top: 5px;
189}
141190
=== modified file 'addons/openerp/widgets/listgrid.py'
--- addons/openerp/widgets/listgrid.py 2020-04-01 10:02:24 +0000
+++ addons/openerp/widgets/listgrid.py 2020-08-06 16:14:57 +0000
@@ -661,6 +661,14 @@
661class M2M(Char):661class M2M(Char):
662662
663 def get_text(self):663 def get_text(self):
664 if self.truncate:
665 if not self.value:
666 return ''
667 max_length = int(self.truncate)
668 value_string = ', '.join([x[1] for x in rpc.RPCProxy(self.attrs['relation']).name_get(self.value, rpc.session.context)])
669 if len(value_string) > max_length:
670 value_string = '%s...' % value_string[:max_length-3]
671 return value_string
664 return "%d" % len(self.value)672 return "%d" % len(self.value)
665673
666class Selection(Char):674class Selection(Char):
@@ -898,6 +906,8 @@
898 def update_params(self, params):906 def update_params(self, params):
899 super(Hidden, self).update_params(params)907 super(Hidden, self).update_params(params)
900908
909class URL(Char):
910 template = "openerp/widgets/templates/listgrid/url.mako"
901911
902CELLTYPES = {912CELLTYPES = {
903 'char':Char,913 'char':Char,
@@ -917,4 +927,5 @@
917 'separator': Separator,927 'separator': Separator,
918 'human_size': HumanSize,928 'human_size': HumanSize,
919 'html_text': HtmlText,929 'html_text': HtmlText,
930 'url': URL,
920}931}
921932
=== added file 'addons/openerp/widgets/templates/listgrid/url.mako'
--- addons/openerp/widgets/templates/listgrid/url.mako 1970-01-01 00:00:00 +0000
+++ addons/openerp/widgets/templates/listgrid/url.mako 2020-08-06 16:14:57 +0000
@@ -0,0 +1,3 @@
1% if text:
2<a href="${text}" target="_blank"><img src="/openerp/static/images/icons/gtk-jump-to-ltr.png" title="${text}" /></a>
3% endif
04
=== modified file 'openobject/static/css/jquery.fancybox-1.3.1.css'
--- openobject/static/css/jquery.fancybox-1.3.1.css 2010-08-30 10:24:02 +0000
+++ openobject/static/css/jquery.fancybox-1.3.1.css 2020-08-06 16:14:57 +0000
@@ -114,6 +114,7 @@
114 background-position: -40px 0;114 background-position: -40px 0;
115 cursor: pointer;115 cursor: pointer;
116 z-index: 1103;116 z-index: 1103;
117 display: none;
117}118}
118119
119#fancybox_error {120#fancybox_error {

Subscribers

People subscribed via source and target branches