Browse Source

Merge branch 'feature/reset-dashboard' into dev

Denis K 9 years ago
parent
commit
0ab9b7f905

+ 1 - 0
CHANGELOG.rst

@@ -4,6 +4,7 @@ Changelog
 0.0.9
 -----
 * [Feature] Replace sidemenu scrollbars with Mac-like ones
+* [Feature] Add dashboard reset button
 * [Fix] Fixed filter submit block text alignment
 * [Fix] Made boolean field icon style global
 

+ 28 - 0
jet/dashboard/forms.py

@@ -130,3 +130,31 @@ class RemoveDashboardModuleForm(forms.ModelForm):
     def save(self, commit=True):
         if commit:
             self.instance.delete()
+
+
+class ResetDashboardForm(forms.Form):
+    app_label = forms.CharField(required=False)
+
+    def __init__(self, request, *args, **kwargs):
+        self.request = request
+        super(ResetDashboardForm, self).__init__(*args, **kwargs)
+
+    class Meta:
+        model = UserDashboardModule
+        fields = []
+
+    def clean(self):
+        data = super(ResetDashboardForm, self).clean()
+        data['app_label'] = data['app_label'] if data['app_label'] else None
+
+        if not self.request.user.is_authenticated():
+            raise ValidationError('error')
+
+        return data
+
+    def save(self, commit=True):
+        if commit:
+            UserDashboardModule.objects.filter(
+                user=self.request.user.pk,
+                app_label=self.cleaned_data['app_label']
+            ).delete()

+ 8 - 0
jet/dashboard/templates/jet.dashboard/dashboard_tools.html

@@ -18,6 +18,14 @@
         </select><a href="#" class="button button-secondary add-dashboard-link" title="{% trans "Add" %}"><span class="icon-add"></span></a>
         <input type="hidden" name="app_label" value="{% if app_label %}{{ app_label }}{% endif %}">
         <input type="hidden" name="type" value="">
+        <a href="#" class="button button-transparent reset-dashboard-link" title="{% trans "Reset widgets" %}"><span class="icon-reset"></span></a>
     </form>
+    <form action="{% url "jet-dashboard:reset_dashboard" %}" method="POST" id="reset-dashboard-form">
+        {% csrf_token %}
+        <input type="hidden" name="app_label" value="{% if app_label %}{{ app_label }}{% endif %}">
+    </form>
+    <div class="dialog-confirm" id="reset-dashboard-dialog" title="{% trans "Reset widgets" %}">
+        <p>{% trans "Are you sure want to reset widgets?" %}</p>
+    </div>
 </div>
 

+ 1 - 1
jet/dashboard/urls.py

@@ -38,7 +38,7 @@ urlpatterns = patterns(
         name='load_dashboard_module'
     ),
     url(
-        r'^reset_dashboard/((?P<app_label>[^/]+)/)?$',
+        r'^reset_dashboard/$',
         reset_dashboard_view,
         name='reset_dashboard'
     ),

+ 11 - 7
jet/dashboard/views.py

@@ -4,7 +4,7 @@ from django.forms.formsets import formset_factory
 from django.shortcuts import redirect
 from django.views.decorators.http import require_POST, require_GET
 from jet.dashboard.forms import UpdateDashboardModulesForm, AddUserDashboardModuleForm, \
-    UpdateDashboardModuleCollapseForm, RemoveDashboardModuleForm
+    UpdateDashboardModuleCollapseForm, RemoveDashboardModuleForm, ResetDashboardForm
 from jet.dashboard.models import UserDashboardModule
 from jet.utils import JsonResponse, get_app_list, SuccessMessageMixin
 from django.views.generic import UpdateView
@@ -214,10 +214,14 @@ def load_dashboard_module_view(request, pk):
     return JsonResponse(result)
 
 
-def reset_dashboard_view(request, app_label=None):
-    UserDashboardModule.objects.filter(user=request.user.pk, app_label=app_label).delete()
-    if app_label:
-        url = reverse('admin:app_list', kwargs={'app_label': app_label})
+@require_POST
+def reset_dashboard_view(request):
+    result = {'error': False}
+    form = ResetDashboardForm(request, request.POST)
+
+    if form.is_valid():
+        form.save()
     else:
-        url = reverse('admin:index')
-    return redirect(url)
+        result['error'] = True
+
+    return JsonResponse(result)

BIN
jet/locale/en/LC_MESSAGES/django.mo


+ 60 - 51
jet/locale/en/LC_MESSAGES/django.po

@@ -6,7 +6,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-09-07 13:42+0000\n"
+"POT-Creation-Date: 2015-09-11 12:45+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -23,16 +23,16 @@ msgstr ""
 msgid "Return to site"
 msgstr ""
 
-#: dashboard/dashboard.py:166 templates/admin/base.html:77
+#: dashboard/dashboard.py:166 templates/admin/base.html:80
 msgid "Change password"
 msgstr ""
 
-#: dashboard/dashboard.py:168 templates/admin/base.html:81
+#: dashboard/dashboard.py:168 templates/admin/base.html:84
 msgid "Log out"
 msgstr ""
 
 #: dashboard/dashboard.py:176 dashboard/modules.py:160
-#: templates/admin/base.html:157 templates/admin/index.html:14
+#: templates/admin/base.html:160 templates/admin/index.html:14
 msgid "Applications"
 msgstr ""
 
@@ -80,62 +80,62 @@ msgid "Grant access"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:161
-#: dashboard/dashboard_modules/yandex_metrika.py:113
+#: dashboard/dashboard_modules/yandex_metrika.py:116
 msgid "Access"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:162
-#: dashboard/dashboard_modules/yandex_metrika.py:114
+#: dashboard/dashboard_modules/yandex_metrika.py:117
 msgid "Counter"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:163
-#: dashboard/dashboard_modules/yandex_metrika.py:115
+#: dashboard/dashboard_modules/yandex_metrika.py:118
 msgid "Statistics period"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:164
-#: dashboard/dashboard_modules/yandex_metrika.py:116
+#: dashboard/dashboard_modules/yandex_metrika.py:119
 msgid "Today"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:165
-#: dashboard/dashboard_modules/yandex_metrika.py:117
+#: dashboard/dashboard_modules/yandex_metrika.py:120
 msgid "Last week"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:166
-#: dashboard/dashboard_modules/yandex_metrika.py:118
+#: dashboard/dashboard_modules/yandex_metrika.py:121
 msgid "Last month"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:167
-#: dashboard/dashboard_modules/yandex_metrika.py:119
+#: dashboard/dashboard_modules/yandex_metrika.py:122
 msgid "Last quarter"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:168
-#: dashboard/dashboard_modules/yandex_metrika.py:120
+#: dashboard/dashboard_modules/yandex_metrika.py:123
 msgid "Last year"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:178
-#: dashboard/dashboard_modules/yandex_metrika.py:130
+#: dashboard/dashboard_modules/yandex_metrika.py:133
 msgid "none"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:181
-#: dashboard/dashboard_modules/yandex_metrika.py:133
+#: dashboard/dashboard_modules/yandex_metrika.py:136
 msgid "grant access first"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:181
-#: dashboard/dashboard_modules/yandex_metrika.py:133
+#: dashboard/dashboard_modules/yandex_metrika.py:136
 msgid "counters loading failed"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:186
-#: dashboard/dashboard_modules/yandex_metrika.py:138
+#: dashboard/dashboard_modules/yandex_metrika.py:141
 msgid "Show"
 msgstr ""
 
@@ -150,7 +150,7 @@ msgid "Sessions"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:189
-#: dashboard/dashboard_modules/yandex_metrika.py:141
+#: dashboard/dashboard_modules/yandex_metrika.py:144
 #: dashboard/templates/jet.dashboard/modules/google_analytics_period_visitors.html:17
 #: dashboard/templates/jet.dashboard/modules/yandex_metrika_period_visitors.html:17
 msgid "Views"
@@ -158,29 +158,29 @@ msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:191
 #: dashboard/dashboard_modules/google_analytics.py:199
-#: dashboard/dashboard_modules/yandex_metrika.py:143
-#: dashboard/dashboard_modules/yandex_metrika.py:151
+#: dashboard/dashboard_modules/yandex_metrika.py:146
+#: dashboard/dashboard_modules/yandex_metrika.py:154
 msgid "Group"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:192
 #: dashboard/dashboard_modules/google_analytics.py:200
-#: dashboard/dashboard_modules/yandex_metrika.py:144
-#: dashboard/dashboard_modules/yandex_metrika.py:152
+#: dashboard/dashboard_modules/yandex_metrika.py:147
+#: dashboard/dashboard_modules/yandex_metrika.py:155
 msgid "By day"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:193
 #: dashboard/dashboard_modules/google_analytics.py:201
-#: dashboard/dashboard_modules/yandex_metrika.py:145
-#: dashboard/dashboard_modules/yandex_metrika.py:153
+#: dashboard/dashboard_modules/yandex_metrika.py:148
+#: dashboard/dashboard_modules/yandex_metrika.py:156
 msgid "By week"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:194
 #: dashboard/dashboard_modules/google_analytics.py:202
-#: dashboard/dashboard_modules/yandex_metrika.py:146
-#: dashboard/dashboard_modules/yandex_metrika.py:154
+#: dashboard/dashboard_modules/yandex_metrika.py:149
+#: dashboard/dashboard_modules/yandex_metrika.py:157
 msgid "By month"
 msgstr ""
 
@@ -200,13 +200,13 @@ msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:297
 #: dashboard/dashboard_modules/google_analytics_views.py:42
-#: dashboard/dashboard_modules/yandex_metrika.py:231
+#: dashboard/dashboard_modules/yandex_metrika.py:234
 #: dashboard/dashboard_modules/yandex_metrika_views.py:37
 msgid "API request failed."
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:299
-#: dashboard/dashboard_modules/yandex_metrika.py:233
+#: dashboard/dashboard_modules/yandex_metrika.py:236
 #, python-format
 msgid " Try to <a href=\"%s\">revoke and grant access</a> again"
 msgstr ""
@@ -224,16 +224,16 @@ msgid "sessions"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:318
-#: dashboard/dashboard_modules/yandex_metrika.py:254
+#: dashboard/dashboard_modules/yandex_metrika.py:257
 msgid "views"
 msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:320
 #: dashboard/dashboard_modules/google_analytics.py:365
 #: dashboard/dashboard_modules/google_analytics.py:404
-#: dashboard/dashboard_modules/yandex_metrika.py:256
-#: dashboard/dashboard_modules/yandex_metrika.py:295
-#: dashboard/dashboard_modules/yandex_metrika.py:328
+#: dashboard/dashboard_modules/yandex_metrika.py:259
+#: dashboard/dashboard_modules/yandex_metrika.py:298
+#: dashboard/dashboard_modules/yandex_metrika.py:331
 msgid "Bad server response"
 msgstr ""
 
@@ -257,51 +257,51 @@ msgstr ""
 msgid "Bad arguments"
 msgstr ""
 
-#: dashboard/dashboard_modules/yandex_metrika.py:139
+#: dashboard/dashboard_modules/yandex_metrika.py:142
 #: dashboard/templates/jet.dashboard/modules/yandex_metrika_period_visitors.html:15
 msgid "Visitors"
 msgstr ""
 
-#: dashboard/dashboard_modules/yandex_metrika.py:140
+#: dashboard/dashboard_modules/yandex_metrika.py:143
 #: dashboard/templates/jet.dashboard/modules/yandex_metrika_period_visitors.html:16
 msgid "Visits"
 msgstr ""
 
-#: dashboard/dashboard_modules/yandex_metrika.py:214
+#: dashboard/dashboard_modules/yandex_metrika.py:217
 #, python-format
 msgid ""
 "Please <a href=\"%s\">attach Yandex account and choose Yandex Metrika "
 "counter</a> to start using widget"
 msgstr ""
 
-#: dashboard/dashboard_modules/yandex_metrika.py:217
+#: dashboard/dashboard_modules/yandex_metrika.py:220
 #, python-format
 msgid ""
 "Please <a href=\"%s\">select Yandex Metrika counter</a> to start using widget"
 msgstr ""
 
-#: dashboard/dashboard_modules/yandex_metrika.py:240
+#: dashboard/dashboard_modules/yandex_metrika.py:243
 msgid "Yandex Metrika visitors totals"
 msgstr ""
 
-#: dashboard/dashboard_modules/yandex_metrika.py:252
+#: dashboard/dashboard_modules/yandex_metrika.py:255
 msgid "visitors"
 msgstr ""
 
-#: dashboard/dashboard_modules/yandex_metrika.py:253
+#: dashboard/dashboard_modules/yandex_metrika.py:256
 msgid "visits"
 msgstr ""
 
-#: dashboard/dashboard_modules/yandex_metrika.py:260
+#: dashboard/dashboard_modules/yandex_metrika.py:263
 msgid "Yandex Metrika visitors chart"
 msgstr ""
 
-#: dashboard/dashboard_modules/yandex_metrika.py:299
+#: dashboard/dashboard_modules/yandex_metrika.py:302
 msgid "Yandex Metrika period visitors"
 msgstr ""
 
 #: dashboard/models.py:11 dashboard/modules.py:116
-#: templates/admin/base.html:189
+#: templates/admin/base.html:192
 msgid "Title"
 msgstr ""
 
@@ -345,7 +345,7 @@ msgstr ""
 msgid "user dashboard modules"
 msgstr ""
 
-#: dashboard/modules.py:115 models.py:12 templates/admin/base.html:191
+#: dashboard/modules.py:115 models.py:12 templates/admin/base.html:194
 msgid "URL"
 msgstr ""
 
@@ -399,7 +399,7 @@ msgstr ""
 
 #: dashboard/templates/admin/app_index.html:32
 #: dashboard/templates/jet.dashboard/update_module.html:14
-#: templates/admin/base.html:92 templates/admin/base.html.py:141
+#: templates/admin/base.html:95 templates/admin/base.html.py:144
 #: templates/admin/change_form.html:17 templates/admin/change_list.html:33
 #: templates/admin/delete_confirmation.html:8
 #: templates/admin/delete_selected_confirmation.html:8
@@ -437,6 +437,15 @@ msgstr ""
 msgid "Add"
 msgstr ""
 
+#: dashboard/templates/jet.dashboard/dashboard_tools.html:21
+#: dashboard/templates/jet.dashboard/dashboard_tools.html:27
+msgid "Reset widgets"
+msgstr ""
+
+#: dashboard/templates/jet.dashboard/dashboard_tools.html:28
+msgid "Are you sure want to reset widgets?"
+msgstr ""
+
 #: dashboard/templates/jet.dashboard/module.html:19
 #: dashboard/templates/jet.dashboard/modules/app_list.html:24
 #: dashboard/templates/jet.dashboard/modules/model_list.html:14
@@ -500,7 +509,7 @@ msgid "Please correct the errors below."
 msgstr ""
 
 #: dashboard/templates/jet.dashboard/update_module.html:126
-#: templates/admin/base.html:211 templates/admin/base.html.py:218
+#: templates/admin/base.html:214 templates/admin/base.html.py:221
 #: templates/admin/edit_inline/stacked.html:21
 #: templates/admin/edit_inline/stacked.html:75
 #: templates/admin/edit_inline/tabular.html:100
@@ -543,7 +552,7 @@ msgstr ""
 msgid "bookmark"
 msgstr ""
 
-#: models.py:19 templates/admin/base.html:204
+#: models.py:19 templates/admin/base.html:207
 msgid "bookmarks"
 msgstr ""
 
@@ -576,27 +585,27 @@ msgstr ""
 msgid "Clear selection"
 msgstr ""
 
-#: templates/admin/base.html:146
+#: templates/admin/base.html:149
 msgid "View site"
 msgstr ""
 
-#: templates/admin/base.html:186 templates/admin/base.html.py:203
+#: templates/admin/base.html:189 templates/admin/base.html.py:206
 msgid "Add bookmark"
 msgstr ""
 
-#: templates/admin/base.html:199
+#: templates/admin/base.html:202
 msgid "Delete bookmark"
 msgstr ""
 
-#: templates/admin/base.html:200
+#: templates/admin/base.html:203
 msgid "Are you sure want to delete this bookmark?"
 msgstr ""
 
-#: templates/admin/base.html:226
+#: templates/admin/base.html:229
 msgid "Documentation"
 msgstr ""
 
-#: templates/admin/base.html:249
+#: templates/admin/base.html:252
 msgid "Application page"
 msgstr ""
 

BIN
jet/locale/en/LC_MESSAGES/djangojs.mo


+ 16 - 9
jet/locale/en/LC_MESSAGES/djangojs.po

@@ -6,7 +6,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-08-07 13:32+0000\n"
+"POT-Creation-Date: 2015-09-11 12:44+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -15,36 +15,43 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: static/jet/js/main.js:266
+#: static/jet/js/main.js:266 static/jet/js/main.min.js:1
 msgid "Add"
 msgstr ""
 
 #: static/jet/js/main.js:271 static/jet/js/main.js:315
-#: static/jet/js/main.js:721
+#: static/jet/js/main.js:766 static/jet/js/main.js:862
+#: static/jet/js/main.min.js:1 static/jet/js/main.min.js:2
+#: static/jet/js/main.min.js:3
 msgid "Cancel"
 msgstr ""
 
-#: static/jet/js/main.js:310 static/jet/js/main.js:716
+#: static/jet/js/main.js:310 static/jet/js/main.js:761
+#: static/jet/js/main.min.js:1 static/jet/js/main.min.js:2
 msgid "Delete"
 msgstr ""
 
-#: static/jet/js/main.js:336
+#: static/jet/js/main.js:336 static/jet/js/main.min.js:1
 msgid "Hide applications"
 msgstr ""
 
-#: static/jet/js/main.js:338
+#: static/jet/js/main.js:338 static/jet/js/main.min.js:1
 msgid "Show hidden"
 msgstr ""
 
-#: static/jet/js/main.js:792
+#: static/jet/js/main.js:857 static/jet/js/main.min.js:3
+msgid "Yes"
+msgstr ""
+
+#: static/jet/js/main.js:884 static/jet/js/main.min.js:3
 msgid "Warning: you have unsaved changes"
 msgstr ""
 
-#: static/jet/js/select2.jet.js:108
+#: static/jet/js/select2.jet.js:108 static/jet/js/select2.jet.min.js:1
 msgid "select all"
 msgstr ""
 
-#: static/jet/js/select2.jet.js:111
+#: static/jet/js/select2.jet.js:111 static/jet/js/select2.jet.min.js:1
 msgid "deselect all"
 msgstr ""
 

BIN
jet/locale/ru/LC_MESSAGES/django.mo


+ 60 - 51
jet/locale/ru/LC_MESSAGES/django.po

@@ -6,7 +6,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-09-07 13:42+0000\n"
+"POT-Creation-Date: 2015-09-11 12:45+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -25,16 +25,16 @@ msgstr "Быстрые ссылки"
 msgid "Return to site"
 msgstr "Вернуться на сайт"
 
-#: dashboard/dashboard.py:166 templates/admin/base.html:77
+#: dashboard/dashboard.py:166 templates/admin/base.html:80
 msgid "Change password"
 msgstr ""
 
-#: dashboard/dashboard.py:168 templates/admin/base.html:81
+#: dashboard/dashboard.py:168 templates/admin/base.html:84
 msgid "Log out"
 msgstr ""
 
 #: dashboard/dashboard.py:176 dashboard/modules.py:160
-#: templates/admin/base.html:157 templates/admin/index.html:14
+#: templates/admin/base.html:160 templates/admin/index.html:14
 msgid "Applications"
 msgstr "Приложения"
 
@@ -82,62 +82,62 @@ msgid "Grant access"
 msgstr "Предоставить доступ"
 
 #: dashboard/dashboard_modules/google_analytics.py:161
-#: dashboard/dashboard_modules/yandex_metrika.py:113
+#: dashboard/dashboard_modules/yandex_metrika.py:116
 msgid "Access"
 msgstr "Доступ"
 
 #: dashboard/dashboard_modules/google_analytics.py:162
-#: dashboard/dashboard_modules/yandex_metrika.py:114
+#: dashboard/dashboard_modules/yandex_metrika.py:117
 msgid "Counter"
 msgstr "Счетчик"
 
 #: dashboard/dashboard_modules/google_analytics.py:163
-#: dashboard/dashboard_modules/yandex_metrika.py:115
+#: dashboard/dashboard_modules/yandex_metrika.py:118
 msgid "Statistics period"
 msgstr "Статистика за период"
 
 #: dashboard/dashboard_modules/google_analytics.py:164
-#: dashboard/dashboard_modules/yandex_metrika.py:116
+#: dashboard/dashboard_modules/yandex_metrika.py:119
 msgid "Today"
 msgstr "Сегодня"
 
 #: dashboard/dashboard_modules/google_analytics.py:165
-#: dashboard/dashboard_modules/yandex_metrika.py:117
+#: dashboard/dashboard_modules/yandex_metrika.py:120
 msgid "Last week"
 msgstr "Последняя неделя"
 
 #: dashboard/dashboard_modules/google_analytics.py:166
-#: dashboard/dashboard_modules/yandex_metrika.py:118
+#: dashboard/dashboard_modules/yandex_metrika.py:121
 msgid "Last month"
 msgstr "Последний месяц"
 
 #: dashboard/dashboard_modules/google_analytics.py:167
-#: dashboard/dashboard_modules/yandex_metrika.py:119
+#: dashboard/dashboard_modules/yandex_metrika.py:122
 msgid "Last quarter"
 msgstr "Последний квартал"
 
 #: dashboard/dashboard_modules/google_analytics.py:168
-#: dashboard/dashboard_modules/yandex_metrika.py:120
+#: dashboard/dashboard_modules/yandex_metrika.py:123
 msgid "Last year"
 msgstr "Последний год"
 
 #: dashboard/dashboard_modules/google_analytics.py:178
-#: dashboard/dashboard_modules/yandex_metrika.py:130
+#: dashboard/dashboard_modules/yandex_metrika.py:133
 msgid "none"
 msgstr "не указано"
 
 #: dashboard/dashboard_modules/google_analytics.py:181
-#: dashboard/dashboard_modules/yandex_metrika.py:133
+#: dashboard/dashboard_modules/yandex_metrika.py:136
 msgid "grant access first"
 msgstr "сначала предоставьте доступ"
 
 #: dashboard/dashboard_modules/google_analytics.py:181
-#: dashboard/dashboard_modules/yandex_metrika.py:133
+#: dashboard/dashboard_modules/yandex_metrika.py:136
 msgid "counters loading failed"
 msgstr "не удалось загрузить счетчики"
 
 #: dashboard/dashboard_modules/google_analytics.py:186
-#: dashboard/dashboard_modules/yandex_metrika.py:138
+#: dashboard/dashboard_modules/yandex_metrika.py:141
 msgid "Show"
 msgstr "Показывать"
 
@@ -152,7 +152,7 @@ msgid "Sessions"
 msgstr "Сессии"
 
 #: dashboard/dashboard_modules/google_analytics.py:189
-#: dashboard/dashboard_modules/yandex_metrika.py:141
+#: dashboard/dashboard_modules/yandex_metrika.py:144
 #: dashboard/templates/jet.dashboard/modules/google_analytics_period_visitors.html:17
 #: dashboard/templates/jet.dashboard/modules/yandex_metrika_period_visitors.html:17
 msgid "Views"
@@ -160,29 +160,29 @@ msgstr "Просмотры"
 
 #: dashboard/dashboard_modules/google_analytics.py:191
 #: dashboard/dashboard_modules/google_analytics.py:199
-#: dashboard/dashboard_modules/yandex_metrika.py:143
-#: dashboard/dashboard_modules/yandex_metrika.py:151
+#: dashboard/dashboard_modules/yandex_metrika.py:146
+#: dashboard/dashboard_modules/yandex_metrika.py:154
 msgid "Group"
 msgstr "Группировать"
 
 #: dashboard/dashboard_modules/google_analytics.py:192
 #: dashboard/dashboard_modules/google_analytics.py:200
-#: dashboard/dashboard_modules/yandex_metrika.py:144
-#: dashboard/dashboard_modules/yandex_metrika.py:152
+#: dashboard/dashboard_modules/yandex_metrika.py:147
+#: dashboard/dashboard_modules/yandex_metrika.py:155
 msgid "By day"
 msgstr "По дням"
 
 #: dashboard/dashboard_modules/google_analytics.py:193
 #: dashboard/dashboard_modules/google_analytics.py:201
-#: dashboard/dashboard_modules/yandex_metrika.py:145
-#: dashboard/dashboard_modules/yandex_metrika.py:153
+#: dashboard/dashboard_modules/yandex_metrika.py:148
+#: dashboard/dashboard_modules/yandex_metrika.py:156
 msgid "By week"
 msgstr "По неделям"
 
 #: dashboard/dashboard_modules/google_analytics.py:194
 #: dashboard/dashboard_modules/google_analytics.py:202
-#: dashboard/dashboard_modules/yandex_metrika.py:146
-#: dashboard/dashboard_modules/yandex_metrika.py:154
+#: dashboard/dashboard_modules/yandex_metrika.py:149
+#: dashboard/dashboard_modules/yandex_metrika.py:157
 msgid "By month"
 msgstr "По месяцам"
 
@@ -205,13 +205,13 @@ msgstr ""
 
 #: dashboard/dashboard_modules/google_analytics.py:297
 #: dashboard/dashboard_modules/google_analytics_views.py:42
-#: dashboard/dashboard_modules/yandex_metrika.py:231
+#: dashboard/dashboard_modules/yandex_metrika.py:234
 #: dashboard/dashboard_modules/yandex_metrika_views.py:37
 msgid "API request failed."
 msgstr "Ошибка запроса к API."
 
 #: dashboard/dashboard_modules/google_analytics.py:299
-#: dashboard/dashboard_modules/yandex_metrika.py:233
+#: dashboard/dashboard_modules/yandex_metrika.py:236
 #, python-format
 msgid " Try to <a href=\"%s\">revoke and grant access</a> again"
 msgstr " Попробуйте <a href=\"%s\">убрать и предоставить доступ</a> заново"
@@ -229,16 +229,16 @@ msgid "sessions"
 msgstr "сессии"
 
 #: dashboard/dashboard_modules/google_analytics.py:318
-#: dashboard/dashboard_modules/yandex_metrika.py:254
+#: dashboard/dashboard_modules/yandex_metrika.py:257
 msgid "views"
 msgstr "просмотры"
 
 #: dashboard/dashboard_modules/google_analytics.py:320
 #: dashboard/dashboard_modules/google_analytics.py:365
 #: dashboard/dashboard_modules/google_analytics.py:404
-#: dashboard/dashboard_modules/yandex_metrika.py:256
-#: dashboard/dashboard_modules/yandex_metrika.py:295
-#: dashboard/dashboard_modules/yandex_metrika.py:328
+#: dashboard/dashboard_modules/yandex_metrika.py:259
+#: dashboard/dashboard_modules/yandex_metrika.py:298
+#: dashboard/dashboard_modules/yandex_metrika.py:331
 msgid "Bad server response"
 msgstr "Некорректный ответ сервера"
 
@@ -262,17 +262,17 @@ msgstr "Модуль не найден"
 msgid "Bad arguments"
 msgstr "Некорректные аргументы"
 
-#: dashboard/dashboard_modules/yandex_metrika.py:139
+#: dashboard/dashboard_modules/yandex_metrika.py:142
 #: dashboard/templates/jet.dashboard/modules/yandex_metrika_period_visitors.html:15
 msgid "Visitors"
 msgstr "Посетители"
 
-#: dashboard/dashboard_modules/yandex_metrika.py:140
+#: dashboard/dashboard_modules/yandex_metrika.py:143
 #: dashboard/templates/jet.dashboard/modules/yandex_metrika_period_visitors.html:16
 msgid "Visits"
 msgstr "Визиты"
 
-#: dashboard/dashboard_modules/yandex_metrika.py:214
+#: dashboard/dashboard_modules/yandex_metrika.py:217
 #, python-format
 msgid ""
 "Please <a href=\"%s\">attach Yandex account and choose Yandex Metrika "
@@ -281,35 +281,35 @@ msgstr ""
 "Пожалуйста <a href=\"%s\">прикрепите аккаунт Яндекс и выберите счетчик "
 "Яндекс Метрики</a> для виджета"
 
-#: dashboard/dashboard_modules/yandex_metrika.py:217
+#: dashboard/dashboard_modules/yandex_metrika.py:220
 #, python-format
 msgid ""
 "Please <a href=\"%s\">select Yandex Metrika counter</a> to start using widget"
 msgstr ""
 "Пожалуйста <a href=\"%s\">выберите счетчик Яндекс Метрики</a> для виджета"
 
-#: dashboard/dashboard_modules/yandex_metrika.py:240
+#: dashboard/dashboard_modules/yandex_metrika.py:243
 msgid "Yandex Metrika visitors totals"
 msgstr "Данные о посещениях Яндекс Метрики"
 
-#: dashboard/dashboard_modules/yandex_metrika.py:252
+#: dashboard/dashboard_modules/yandex_metrika.py:255
 msgid "visitors"
 msgstr "посетители"
 
-#: dashboard/dashboard_modules/yandex_metrika.py:253
+#: dashboard/dashboard_modules/yandex_metrika.py:256
 msgid "visits"
 msgstr "визиты"
 
-#: dashboard/dashboard_modules/yandex_metrika.py:260
+#: dashboard/dashboard_modules/yandex_metrika.py:263
 msgid "Yandex Metrika visitors chart"
 msgstr "График посещений Яндекс Метрики"
 
-#: dashboard/dashboard_modules/yandex_metrika.py:299
+#: dashboard/dashboard_modules/yandex_metrika.py:302
 msgid "Yandex Metrika period visitors"
 msgstr "Посещения Яндекс Метрики за период"
 
 #: dashboard/models.py:11 dashboard/modules.py:116
-#: templates/admin/base.html:189
+#: templates/admin/base.html:192
 msgid "Title"
 msgstr "Название"
 
@@ -353,7 +353,7 @@ msgstr ""
 msgid "user dashboard modules"
 msgstr ""
 
-#: dashboard/modules.py:115 models.py:12 templates/admin/base.html:191
+#: dashboard/modules.py:115 models.py:12 templates/admin/base.html:194
 msgid "URL"
 msgstr "URL"
 
@@ -407,7 +407,7 @@ msgstr "Необходимо указать корректный URL поток
 
 #: dashboard/templates/admin/app_index.html:32
 #: dashboard/templates/jet.dashboard/update_module.html:14
-#: templates/admin/base.html:92 templates/admin/base.html.py:141
+#: templates/admin/base.html:95 templates/admin/base.html.py:144
 #: templates/admin/change_form.html:17 templates/admin/change_list.html:33
 #: templates/admin/delete_confirmation.html:8
 #: templates/admin/delete_selected_confirmation.html:8
@@ -445,6 +445,15 @@ msgstr "изначальные"
 msgid "Add"
 msgstr ""
 
+#: dashboard/templates/jet.dashboard/dashboard_tools.html:21
+#: dashboard/templates/jet.dashboard/dashboard_tools.html:27
+msgid "Reset widgets"
+msgstr "Сбросить виджеты"
+
+#: dashboard/templates/jet.dashboard/dashboard_tools.html:28
+msgid "Are you sure want to reset widgets?"
+msgstr "Вы точно хотите сбросить виджеты?"
+
 #: dashboard/templates/jet.dashboard/module.html:19
 #: dashboard/templates/jet.dashboard/modules/app_list.html:24
 #: dashboard/templates/jet.dashboard/modules/model_list.html:14
@@ -508,7 +517,7 @@ msgid "Please correct the errors below."
 msgstr ""
 
 #: dashboard/templates/jet.dashboard/update_module.html:126
-#: templates/admin/base.html:211 templates/admin/base.html.py:218
+#: templates/admin/base.html:214 templates/admin/base.html.py:221
 #: templates/admin/edit_inline/stacked.html:21
 #: templates/admin/edit_inline/stacked.html:75
 #: templates/admin/edit_inline/tabular.html:100
@@ -551,7 +560,7 @@ msgstr ""
 msgid "bookmark"
 msgstr ""
 
-#: models.py:19 templates/admin/base.html:204
+#: models.py:19 templates/admin/base.html:207
 msgid "bookmarks"
 msgstr "закладки"
 
@@ -584,27 +593,27 @@ msgstr ""
 msgid "Clear selection"
 msgstr ""
 
-#: templates/admin/base.html:146
+#: templates/admin/base.html:149
 msgid "View site"
 msgstr ""
 
-#: templates/admin/base.html:186 templates/admin/base.html.py:203
+#: templates/admin/base.html:189 templates/admin/base.html.py:206
 msgid "Add bookmark"
 msgstr "Добавить закладку"
 
-#: templates/admin/base.html:199
+#: templates/admin/base.html:202
 msgid "Delete bookmark"
 msgstr "Удалить закладку"
 
-#: templates/admin/base.html:200
+#: templates/admin/base.html:203
 msgid "Are you sure want to delete this bookmark?"
 msgstr "Вы точно хотите удалить эту закладку?"
 
-#: templates/admin/base.html:226
+#: templates/admin/base.html:229
 msgid "Documentation"
 msgstr ""
 
-#: templates/admin/base.html:249
+#: templates/admin/base.html:252
 msgid "Application page"
 msgstr "Страница приложения"
 

BIN
jet/locale/ru/LC_MESSAGES/djangojs.mo


+ 16 - 9
jet/locale/ru/LC_MESSAGES/djangojs.po

@@ -6,7 +6,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-08-07 13:32+0000\n"
+"POT-Creation-Date: 2015-09-11 12:44+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -15,36 +15,43 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: static/jet/js/main.js:266
+#: static/jet/js/main.js:266 static/jet/js/main.min.js:1
 msgid "Add"
 msgstr "Добавить"
 
 #: static/jet/js/main.js:271 static/jet/js/main.js:315
-#: static/jet/js/main.js:721
+#: static/jet/js/main.js:766 static/jet/js/main.js:862
+#: static/jet/js/main.min.js:1 static/jet/js/main.min.js:2
+#: static/jet/js/main.min.js:3
 msgid "Cancel"
 msgstr "Отмена"
 
-#: static/jet/js/main.js:310 static/jet/js/main.js:716
+#: static/jet/js/main.js:310 static/jet/js/main.js:761
+#: static/jet/js/main.min.js:1 static/jet/js/main.min.js:2
 msgid "Delete"
 msgstr "Удалить"
 
-#: static/jet/js/main.js:336
+#: static/jet/js/main.js:336 static/jet/js/main.min.js:1
 msgid "Hide applications"
 msgstr "Скрыть приложения"
 
-#: static/jet/js/main.js:338
+#: static/jet/js/main.js:338 static/jet/js/main.min.js:1
 msgid "Show hidden"
 msgstr "Показать скрытые"
 
-#: static/jet/js/main.js:792
+#: static/jet/js/main.js:857 static/jet/js/main.min.js:3
+msgid "Yes"
+msgstr "Да"
+
+#: static/jet/js/main.js:884 static/jet/js/main.min.js:3
 msgid "Warning: you have unsaved changes"
 msgstr "Внимание: у вас есть несохраненные изменения"
 
-#: static/jet/js/select2.jet.js:108
+#: static/jet/js/select2.jet.js:108 static/jet/js/select2.jet.min.js:1
 msgid "select all"
 msgstr "выбрать все"
 
-#: static/jet/js/select2.jet.js:111
+#: static/jet/js/select2.jet.js:111 static/jet/js/select2.jet.min.js:1
 msgid "deselect all"
 msgstr "убрать все"
 

+ 6 - 0
jet/static/jet/css/_forms.scss

@@ -62,6 +62,12 @@
     color: $background-button-text-color;
   }
 
+  &.button-transparent {
+    background-color: transparent;
+    color: $text-color;
+    padding: 0 10px;
+  }
+
   &:hover {
     background-color: $button-hover-background-color;
     color: $button-hover-text-color;

+ 1 - 0
jet/static/jet/css/icons/_variables.scss

@@ -1,3 +1,4 @@
+$icon-reset: "\e61e";
 $icon-search: "\e61d";
 $icon-user: "\e61c";
 $icon-jet: "\e61b";

BIN
jet/static/jet/css/icons/fonts/jet-icons.eot


+ 1 - 0
jet/static/jet/css/icons/fonts/jet-icons.svg

@@ -37,4 +37,5 @@
 <glyph unicode="&#xe61b;" glyph-name="jet" d="M136.192 156.16c0 0 54.886 51.2 74.547 28.058s-29.082-65.946-40.141-77.21c-11.264-11.264-79.053-23.962-91.136-73.114s-4.915 19.456 52.838 20.685c57.958 1.024 51.61-1.638 95.437 10.24s59.187 34.611 59.187 34.611 5.325-40.755-54.477-72.294c-59.802-31.539 37.069-3.482 76.186 17.818s62.464 70.246 62.464 70.246 3.072-26.214-36.454-91.75c0 0 159.744 91.341 101.786 235.315 0 0 1.843-72.499-48.538-131.277 0 0 9.216 56.934-6.758 63.693-11.469 4.915-36.659-88.064-77.21-92.774 0 0 29.082 41.574 18.432 56.525-15.155 21.299-87.45-38.707-87.45-38.707s3.686 53.043 79.462 98.714c0 0-29.491 7.782-61.645 1.024 0 0 56.115 46.899 123.699 41.37 0 0-36.864 24.166-71.475 18.842 0 0 14.336 28.877 87.245 26.419 0 0-107.52 55.296-211.149-40.55 0 0 58.778 28.672 93.389-4.506-0.205-0.205-119.194-9.011-138.24-101.376zM363.315 371.814l121.856-116.736c403.456 205.824 470.016 605.184 470.016 605.184s-303.923-45.67-591.872-488.448zM437.043 360.55l-26.624 21.504c283.648 371.712 460.8 409.6 460.8 409.6s-280.576-215.45-434.176-431.104zM508.723 107.827l-9.626 130.867c0 0 82.534 41.37 165.069 113.869zM214.835 397.619l131.072-14.336c0 0 27.853 48.333 119.808 159.744z" />
 <glyph unicode="&#xe61c;" glyph-name="user" d="M851.481 250.954c-39.072 50.987-86.335 84.097-154.057 102.883l-63.453-222.157c0-20.464-16.755-37.216-37.216-37.216-20.455 0-37.21 16.753-37.21 37.216v176.765c0 25.674-20.845 46.519-46.519 46.519s-46.516-20.847-46.516-46.519v-176.765c0-20.464-16.755-37.216-37.212-37.216-20.464 0-37.218 16.753-37.218 37.216l-63.453 222.157c-67.723-18.969-114.985-51.895-154.053-102.883-15.446-20.095-23.839-60.471-24.388-82.063 0.185-5.581 0-12.095 0-18.601v-74.435c0-41.12 33.309-74.425 74.43-74.425h576.815c41.12 0 74.435 33.305 74.435 74.425v74.435c0 6.505-0.182 13.019 0 18.601-0.563 21.591-8.946 61.97-24.383 82.063zM317.649 697.706c0-108.665 67.744-268.315 195.375-268.315 125.413 0 195.371 159.65 195.371 268.315 0 108.661-87.454 196.862-195.371 196.862s-195.375-88.201-195.375-196.862z" />
 <glyph unicode="&#xe61d;" glyph-name="search" d="M120.942 128.031l203.291 203.291c-38.651 53.090-61.716 118.249-61.716 188.955 0 177.713 144.047 321.759 321.759 321.759s321.759-144.047 321.759-321.759-144.047-321.759-321.759-321.759c-70.706 0-135.862 23.068-188.955 61.716l-203.291-203.291-71.089 71.089zM584.274 299.065c121.965 0 221.209 99.243 221.209 221.209s-99.243 221.209-221.209 221.209-221.209-99.243-221.209-221.209 99.243-221.209 221.209-221.209z" />
+<glyph unicode="&#xe61e;" glyph-name="reset" horiz-adv-x="1013" d="M1011.457 476.745c-56.408-0.485-112.778-0.784-169.149-1.269 9.482-97.062-22.511-197.371-96.838-271.586-131.966-131.929-345.801-131.929-477.692 0-131.929 131.817-131.929 345.689 0 477.618 112.554 112.591 284.652 128.607 414.714 49.016-44.088-43.566-95.942-95.158-95.942-95.158-37.331-39.646 0.635-65.927 25.759-66.077h329.562c12.618 0 22.772 10.191 22.809 22.809v326.874c1.531 30.798-32.292 59.432-65.554 26.132 0 0-55.81-55.213-94.56-93.664-198.080 144.771-477.244 128.345-656.174-50.547-197.856-197.856-197.856-518.645 0-716.464 197.819-197.782 518.608-197.782 716.427 0 107.664 107.589 156.195 251.614 146.638 392.316z" />
 </font></defs></svg>

BIN
jet/static/jet/css/icons/fonts/jet-icons.ttf


BIN
jet/static/jet/css/icons/fonts/jet-icons.woff


+ 8 - 5
jet/static/jet/css/icons/style.css

@@ -1,10 +1,10 @@
 @font-face {
 	font-family: 'jet-icons';
-	src:url('fonts/jet-icons.eot?-7wlpt4');
-	src:url('fonts/jet-icons.eot?#iefix-7wlpt4') format('embedded-opentype'),
-		url('fonts/jet-icons.ttf?-7wlpt4') format('truetype'),
-		url('fonts/jet-icons.woff?-7wlpt4') format('woff'),
-		url('fonts/jet-icons.svg?-7wlpt4#jet-icons') format('svg');
+	src:url('fonts/jet-icons.eot?-lem1jo');
+	src:url('fonts/jet-icons.eot?#iefix-lem1jo') format('embedded-opentype'),
+		url('fonts/jet-icons.ttf?-lem1jo') format('truetype'),
+		url('fonts/jet-icons.woff?-lem1jo') format('woff'),
+		url('fonts/jet-icons.svg?-lem1jo#jet-icons') format('svg');
 	font-weight: normal;
 	font-style: normal;
 }
@@ -23,6 +23,9 @@
 	-moz-osx-font-smoothing: grayscale;
 }
 
+.icon-reset:before {
+	content: "\e61e";
+}
 .icon-search:before {
 	content: "\e61d";
 }

+ 38 - 0
jet/static/jet/js/main.js

@@ -833,6 +833,44 @@
                     }
                 });
             });
+
+            $('.reset-dashboard-link').on('click', function(e) {
+                var buttons = {};
+                var resetDashboard = function () {
+                    var $form = $('#reset-dashboard-form');
+
+                    $.ajax({
+                        url: $form.attr('action'),
+                        method: $form.attr('method'),
+                        dataType: 'json',
+                        data: $form.serialize(),
+                        success: function (result) {
+                            if (result.error) {
+                                return;
+                            }
+
+                            location.reload();
+                        }
+                    });
+                };
+
+                buttons[django.gettext('Yes')] = function() {
+                    resetDashboard();
+                    $(this).dialog('close');
+                };
+
+                buttons[django.gettext('Cancel')] = function() {
+                    $(this).dialog('close');
+                };
+
+                $('#reset-dashboard-dialog').dialog({
+                    resizable: false,
+                    modal: true,
+                    buttons: buttons
+                });
+
+                e.preventDefault();
+            });
         };
 
         var initUnsavedChangesWarning = function() {

File diff suppressed because it is too large
+ 0 - 0
jet/static/jet/js/main.min.js


Some files were not shown because too many files changed in this diff