From d184022278dcc8eda19e030799fbaff73950940a Mon Sep 17 00:00:00 2001
From: anonymous <anonymous>
Date: Tue, 18 Jun 2019 11:20:00 +0200
Subject: [PATCH] ODPSH-31: change layout

---
 2                                             |   1 -
 .../de/LC_MESSAGES/ckanext-datarequest.po     |   7 ++++
 .../odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo  | Bin 8174 -> 8305 bytes
 .../odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po  |   8 +++-
 ckanext/odsh/public/odsh.css                  |  29 +++++++++++++
 .../odsh/templates/datarequests/index.html    |   2 +-
 ckanext/odsh/templates/datarequests/new.html  |  20 +++++++++
 .../snippets/datarequest_form.html            |  38 +++++++++++++++++
 .../snippets/datarequest_item.html            |  39 +++++++++++-------
 .../snippets/datarequest_list.html            |   4 +-
 .../snippets/new_datarequest_form.html        |   8 ++++
 ckanext/odsh/tests/test_env.py                |   2 +-
 12 files changed, 137 insertions(+), 21 deletions(-)
 delete mode 100644 2
 create mode 100644 ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-datarequest.po
 create mode 100644 ckanext/odsh/templates/datarequests/new.html
 create mode 100644 ckanext/odsh/templates/datarequests/snippets/datarequest_form.html
 create mode 100644 ckanext/odsh/templates/datarequests/snippets/new_datarequest_form.html

diff --git a/2 b/2
deleted file mode 100644
index 63a93769..00000000
--- a/2
+++ /dev/null
@@ -1 +0,0 @@
-{'fq': u'owner_org:"824ae07b-7a18-4a4d-a3e6-5b8660d635b8"', 'facet.mincount': 0, 'rows': 0, 'facet': u'false', 'extras': {}, 'include_private': True}
diff --git a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-datarequest.po b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-datarequest.po
new file mode 100644
index 00000000..fd21f876
--- /dev/null
+++ b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-datarequest.po
@@ -0,0 +1,7 @@
+#: ckanext/datarequests/templates/datarequests/new.html:3
+#: ckanext/datarequests/templates/datarequests/new.html:7
+#: ckanext/datarequests/templates/datarequests/new.html:11
+#: ckanext/datarequests/templates/datarequests/snippets/datarequest_form.html:47
+#: ckanext/datarequests/templates/datarequests/snippets/new_datarequest_form.html:7
+msgid "Create Data Request"
+msgstr "Datenanfrage "
diff --git a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo
index e1e2fc28386d9e38d24b097017e5f001f29cf108..ab0a6177c3cc3782e3ad5f9f36bd1a9e3e1f5af1 100644
GIT binary patch
delta 2310
zcmaE7|IwlTo)F7a1_lO(HU<U;83qOh9~KY~fonJz7?>Ft7;2$(Bb09CU|;|#?S%6C
zI2ag&7#J8PaWF9OGcYhL<zQgoW?*303Z)NnK+HeO!N9=Ez`*c|gMopafuWw^0|x_x
zI0FO252!)`PKZVsPKZGooD2+H3=9kwoD2+t3=9m;oD2*K3=9mRoD2+-3=9lqQ1J;+
zb&H_-*K$HE+Q|uV*nUn11~vu;hD)3b44e!M3^zF$7$g|#85kZzCH`<SFbFU(FfemL
zEE3^jU=U+qU{K=%yOhC}3*r!0E{MSaTo41pxEL7t7#J90xfmEk85kIHxEL5z85kIv
zxEL6C85kH=a4|5bFfcG|<6>YCVPIgm&BeeV%fP_!0VH3~z`(%A4e^N#H^d+_Ziof0
zP`)=eL}L^;#O3)=x{@0bQqA0ukm~0K`G|pGJ~sn{H3I{~4sHepDFz0HFWiu*;^$#t
z;9+235aEH?qsYU+P_N6tz+k`wad{jM#NrYj1_llW28Jpgh!2~g8oHq3GkG9UwulE}
z@Gc&R1NKAt=b`GaK*b;PKpg%Vs{b!k9UCu0Jvb3@^Fj;~;DrRSC@;i?3Q%!<C~X3z
zEqNIj6d4#8?4bMvUPu(B@<JS*3#H4T;`LB<?Ys~V_3%QXW-@O*B*+#*73|`L1nGWW
z1_o^g28PqTkf8j|3&{n>e2}zZ&Ihr`lMmwXAU*~LVFm_<a6U*#X7fQpsF4qnSZDG<
z(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L@GL|j!)+-20&3t_s6G}ENOqMHftX_`!oZ-$
zz`)=x0tvx95r~C-Q299`5Ql9N0i~gO28M$oko<pA1d>>8i9quELlH<&zk%}qi!d-K
zGcYi4i83%KF)%Rbi9&)jP!yuC07{pOLduCcD8EG%l8w7XAtAXy6q45Vh%zwnf%5+g
zs6pRFAw{H^7{ukqVvryU7K5aXcri#~tQCVKwtg{)kC#LFd&M9gxhe+n@iQ?<)P50z
zMCCs*28Iv@1_lXnNTSRYXJDuYl~mKkA&F$EIK;r6;tUK%3=9nC#UT!1l7RR~NdjV^
zh6KdNMo_+`1SGLJOF)9&LxO?9mVtpGUjpLuwGyD9W?(oZ0r9{o35Y}QNHElc%jCCE
zgT6~Ze8wmVaj~Q%M5D1J#7EYW5Cc3VAr6R^gk;ksNl28WNis0#FfcH5N<yM=n<S)s
zI4B8m_$erT1xnuomA{~}`-LPV)&7%&6p?&V3=HO=+E9vt!GM8*p+pMe;-ylMINv4(
z$qiSfAR)sd4RIKkG$hT)NJAW`FAdRWCe6U00ZNq85c3P9A?DAkmxdU4O&Vh0S7}J<
zSCN6lxt9ziDl%jsK|5OpV!$C8NFw?m!@yt&s=8$%QRgQM3Gx(Kh{ct%5Oca@85pz}
z7#LQ_LQ2xhvJi*Xf0czKIu1FA!K!i)mj%l~4DObLl!$xfAVK+44ie-{@{p)ulZR9~
zeDV-;H02o>EEyOW+~gS;oEaDx8ss5~?FgteGw}CeFbr~KF!Fa}Fb)m!WH6cB&yl%V
YfU}=z^A7Gtj?JMW2F#mhi(lga061yD<p2Nx

diff --git a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po
index 06f011e7..b09176f7 100644
--- a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po
+++ b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po
@@ -413,4 +413,10 @@ msgid "Add Request"
 msgstr "Datensatz vorschlagen"
 
 msgid "Add New Comment"
-msgstr "Kommentieren"
\ No newline at end of file
+msgstr "Kommentieren"
+
+msgid "Create New Data Request"
+msgstr "Neuen Datensatz vorschlagen"
+
+msgid "Suggest New Data Request"
+msgstr "Datensatz vorschlagen"
\ No newline at end of file
diff --git a/ckanext/odsh/public/odsh.css b/ckanext/odsh/public/odsh.css
index 858eaaaa..893d2a64 100644
--- a/ckanext/odsh/public/odsh.css
+++ b/ckanext/odsh/public/odsh.css
@@ -1950,4 +1950,33 @@ p.package-info-categorie
     display: flex;
     justify-content: center;
     padding-top: 20px;
+}
+
+
+.label.label-open
+{
+    color: white;
+    background-color: #003064;
+}
+
+.label.label-open
+{
+    color: white;
+    background-color: #003064;
+}
+
+.datarequest-subtitle
+{ 
+    font-size: 12px;
+    line-height: 12px;
+    height: 12px;
+}
+.datarequest-item-open-time
+{
+    padding-right: 4px;
+    border-right: 1px solid;
+}
+.datarequest-item-autor-name
+{
+    padding-left: 4px;
 }
\ No newline at end of file
diff --git a/ckanext/odsh/templates/datarequests/index.html b/ckanext/odsh/templates/datarequests/index.html
index 5ffe509d..bde650ab 100644
--- a/ckanext/odsh/templates/datarequests/index.html
+++ b/ckanext/odsh/templates/datarequests/index.html
@@ -4,7 +4,7 @@
   <section class="module">
     <div class="module-content">
       {% block page_primary_action %}
-        {% snippet 'snippets/custom_search_form.html', query=c.q, fields=(('organization', c.organization), ('state', c.state)), sorting=c.filters, sorting_selected=c.sort, placeholder=_('Search Data Requests...'), no_bottom_border=true, count=c.datarequest_count, no_title=True %}
+        {% snippet 'snippets/custom_search_form.html', query=c.q, fields=(('organization', c.organization), ('state', c.state)), sorting=c.filters, sorting_selected=c.sort, placeholder=_('Search Data Requests...'), no_bottom_border=false, count=c.datarequest_count, no_title=True %}
         {{ h.snippet('datarequests/snippets/datarequest_list.html', datarequest_count=c.datarequest_count, datarequests=c.datarequests, page=c.page, q=c.q)}}
         {% if h.check_access('create_datarequest') %}
           <div class="add_request_container">
diff --git a/ckanext/odsh/templates/datarequests/new.html b/ckanext/odsh/templates/datarequests/new.html
new file mode 100644
index 00000000..46dd7b08
--- /dev/null
+++ b/ckanext/odsh/templates/datarequests/new.html
@@ -0,0 +1,20 @@
+{% extends "datarequests/base.html" %}
+
+{% block subtitle %}{{ _('Create Data Request') }}{% endblock %}
+
+{% block breadcrumb_content %}
+  <li>{% link_for _('Data Requests'), controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='index' %}</li>
+  <li class="active"><a href="">{{ _('Create Data Request') }}</a></li>
+{% endblock %}
+
+{% block primary_content_inner %}
+  <h1 class="{% block page_heading_class %}page-heading{% endblock %}">{% block page_heading %}{{ _('Create New Data Request') }}{% endblock %}</h1>
+  {% snippet "datarequests/snippets/new_datarequest_form.html", data=c.datarequest, errors=c.errors, errors_summary=c.errors_summary, offering=c.offering %}
+{% endblock %}
+
+{% block secondary_content_additional_info %}
+  <p>{% trans %}To create a data request, fill the form and specify a title and a description for your request. Please, be as clear as you can in order to ease the task of accomplishing your request. You can also specify an organization if your data request is closely related with it. {% endtrans %}
+  </p>
+{% endblock %}
+
+{% block page_header %}{% endblock %}
\ No newline at end of file
diff --git a/ckanext/odsh/templates/datarequests/snippets/datarequest_form.html b/ckanext/odsh/templates/datarequests/snippets/datarequest_form.html
new file mode 100644
index 00000000..54b823f0
--- /dev/null
+++ b/ckanext/odsh/templates/datarequests/snippets/datarequest_form.html
@@ -0,0 +1,38 @@
+{% import 'macros/form.html' as form %}
+
+{% set title = data.get('title', '') %}
+{% set description = data.get('description', '') %}
+{% set organization_id = data.get('organization_id', h.get_request_param('organization')) %}
+{% set organizations_available = h.organizations_available('read') %}
+{% set form_horizontal = 'form-horizontal' if h.ckan_version()[:3] <= '2.7' else '' %}
+
+{# This provides a full page that renders a form for publishing a dataset. It can
+then itself be extended to add/remove blocks of functionality. #}
+<form class="dataset-form {{ form_horizontal }}" method="post" data-module="basic-form" action enctype="multipart/form-data">
+
+  <input type="hidden" id="id" name="id" value="{{ data.get('id', '') }}" />
+
+  {% block errors %}{{ form.errors(errors_summary) }}{% endblock %}
+
+  {% block offering_title %}
+    {{ form.input('title', id='field-title', label=_('Title'), placeholder=_('eg. Data Request Name'), value=title, error=errors['Title'], classes=['control-full', 'control-large'], is_required=true) }}
+  {% endblock %}
+
+  {% block offering_description %}
+    {{ form.markdown('description', id='field-description', label=_('Description'), placeholder=_('eg. Data Request description'), value=description, error=errors['Description']) }}
+  {% endblock %}
+
+
+  {% block form_actions %}
+    <div class="form-actions">
+      {% block delete_button %}
+        {% if h.check_access('delete_datarequest', {'id': data.get('id', '')}) and not data.state == 'deleted' %}
+          {% set locale = h.dump_json({'content': _('Are you sure you want to delete this data request?')}) %}
+          <a class="btn btn-danger pull-left" href="{% url_for controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='delete', id=data.get('id') %}" data-module="confirm-action" data-module-i18n="{{ locale }}">{% block delete_button_text %}{{ _('Delete') }}{% endblock %}</a>
+        {% endif %}
+      {% endblock %}
+      <button class="btn btn-primary" type="submit" name="save">{% block save_button_text %}{{ _('Create Data Request') }}{% endblock %}</button>
+    </div>
+  {% endblock %}
+
+</form>
\ No newline at end of file
diff --git a/ckanext/odsh/templates/datarequests/snippets/datarequest_item.html b/ckanext/odsh/templates/datarequests/snippets/datarequest_item.html
index 046e3fe7..310c114e 100644
--- a/ckanext/odsh/templates/datarequests/snippets/datarequest_item.html
+++ b/ckanext/odsh/templates/datarequests/snippets/datarequest_item.html
@@ -3,31 +3,40 @@
 {% set title = datarequest.get('title', '') %}
 {% set description = h.markdown_extract(datarequest.get('description', ''), extract_length=truncate) %}
 
-<li class="{{ item_class or "dataset-item" }}">
-{{h.odsh_render_datetime(datarequest.open_time)}}|{{datarequest.user.display_name}}
+<div class="container-fluid odsh-dataset-item">
   {% block package_item_content %}
     <div class="dataset-content">
-      <h3 class="dataset-heading">
+      <div class="dataset-heading ">
+        <div class="span1">
         {% if datarequest.get('closed', False) %}
-          <span class="uppercase label label-closed">
-            <i class="icon-lock fa fa-lock"></i> {% trans %}Closed{% endtrans %}
-          </span>
+          <div class="datarequest-label label-closed">
+            {% trans %}Closed{% endtrans %}
+          </div>
         {% else %}
-          <span class="uppercase label label-open">
-            <i class="icon-unlock fa fa-unlock"></i> {% trans %}Open{% endtrans %}
-          </span>
+          <div class="label label-open">
+            {% trans %}Open{% endtrans %}
+          </div>
         {% endif %}
-        {{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='show', id=datarequest.get('id', ''))) }}
-      </h3>
+        </div>
+        <div class='span9'>
+          <div class='datarequest-subtitle'>
+            <span class="datarequest-item-open-time">{{h.odsh_render_datetime(datarequest.open_time)}}</span>
+            <span class="datarequest-item-autor-name">{{datarequest.user['display_name']}}</span>
+          </div>
+          {{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='show', id=datarequest.get('id', ''))) }}
+        </div>
+      </div>
       {% if description %}
         <div>{{ description }}</div>
       {% endif %}
-      <div class="datarequest-properties">
+      {% if h.show_comments_tab() %}
+        <i class="icon-comment fa fa-comment"></i> {{ h.get_comments_number(datarequest.get('id', '')) }}</span>
+      {% endif %}
+    </div>
+     <div class="dataset-meta">
         {% if h.show_comments_tab() %}
-          <i class="icon-comment fa fa-comment"></i> {{ h.get_comments_number(datarequest.get('id', '')) }}</span>
          {% link_for _('Add New Comment'), controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='comment', id=datarequest.get('id',''), class_='btn btn-primary btn-arrow-right'  %}
         {% endif %}
       </div>
-    </div>
   {% endblock %}
-</li>
\ No newline at end of file
+</div>
\ No newline at end of file
diff --git a/ckanext/odsh/templates/datarequests/snippets/datarequest_list.html b/ckanext/odsh/templates/datarequests/snippets/datarequest_list.html
index 2c14adfb..841a8bfa 100644
--- a/ckanext/odsh/templates/datarequests/snippets/datarequest_list.html
+++ b/ckanext/odsh/templates/datarequests/snippets/datarequest_list.html
@@ -4,11 +4,11 @@
 
 {% block datarequest_search_results_list %}
   {% if datarequests %}
-    <ul class="dataset-list unstyled list-unstyled">
+    <div class="dataset-list unstyled">
       {% for datarequest in datarequests %}
         {{ h.snippet('datarequests/snippets/datarequest_item.html', datarequest=datarequest, facet_titles=facet_titles) }}
       {% endfor %}
-    </ul>
+    </div>
   {% else %}
     <p class="empty">
       {{ _('No Data Requests found with the given criteria') }}.
diff --git a/ckanext/odsh/templates/datarequests/snippets/new_datarequest_form.html b/ckanext/odsh/templates/datarequests/snippets/new_datarequest_form.html
new file mode 100644
index 00000000..df537f66
--- /dev/null
+++ b/ckanext/odsh/templates/datarequests/snippets/new_datarequest_form.html
@@ -0,0 +1,8 @@
+{% extends "datarequests/snippets/datarequest_form.html" %}
+
+{% block delete_button %}
+{% endblock %}
+
+{% block save_button_text %}
+  {{ _('Suggest New Data Request') }}
+{% endblock %}
\ No newline at end of file
diff --git a/ckanext/odsh/tests/test_env.py b/ckanext/odsh/tests/test_env.py
index 12f749d8..e153ef72 100644
--- a/ckanext/odsh/tests/test_env.py
+++ b/ckanext/odsh/tests/test_env.py
@@ -147,7 +147,7 @@ class TestEnv:
             for p in ['odsh_icap', 'odsh_dcat_harvest', 'odsh_harvest']:
                 assert p in value, 'missing plugin:' + p
         if isSlave():
-            for p in ['odsh_autocomplete']:
+            for p in ['odsh_autocomplete datarequests']:
                 assert p in value, 'missing plugin:' + p
 
         # pdb.set_trace()
-- 
GitLab