From: Lukasz Rekucki Date: Mon, 24 Aug 2009 07:55:49 +0000 (+0200) Subject: Merge branch 'lq-editor-refactor' X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/cb87c787916de7712a4f9fb638715e6185804711?hp=bf77ae4a3e1a3593c2fac8c289f177aec15602c9 Merge branch 'lq-editor-refactor' --- diff --git a/apps/explorer/views.py b/apps/explorer/views.py index 68fd1921..eeac7b65 100644 --- a/apps/explorer/views.py +++ b/apps/explorer/views.py @@ -3,8 +3,10 @@ import hg, urllib2 from django.utils import simplejson as json from django.views.generic.simple import direct_to_template + from django.conf import settings from django.http import HttpResponseRedirect +from django.contrib.auth.decorators import login_required from explorer import forms, models diff --git a/project/settings.py b/project/settings.py index c5b0c2db..a4187068 100644 --- a/project/settings.py +++ b/project/settings.py @@ -62,6 +62,15 @@ TEMPLATE_LOADERS = ( # 'django.template.loaders.eggs.load_template_source', ) +TEMPLATE_CONTEXT_PROCESSORS = ( + "django.core.context_processors.auth", + "django.core.context_processors.debug", + "django.core.context_processors.i18n", + "django.core.context_processors.media", + "django.core.context_processors.request", +) + + MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', diff --git a/project/static/css/master.css b/project/static/css/master.css index bbd98155..71c9fb4b 100644 --- a/project/static/css/master.css +++ b/project/static/css/master.css @@ -4,10 +4,21 @@ body { overflow: hidden; } -#breadcrumbs { - padding: 2px 10px; +#header { + position: relative; + padding: 2px 0.5em; background-color: #CDCDCD; - border-bottom: 1px solid #858585; + border-bottom: 1px solid black; + clear: both; +} + +#header #breadcrumbs { + +} + +#header #login_info { + position: absolute; + right: 1em; } ul { @@ -238,3 +249,18 @@ label { color: #FFF; cursor: default; } + + +div.isection { + margin: 1em auto; + border: 1px solid black; + padding: 0.5em 2em; + background: #9f9ffa; + + width: 60%; +} + +div.isection p { + margin: 0.5em 1em; +} + diff --git a/project/templates/base.html b/project/templates/base.html index 6e9c389f..9622fa4d 100644 --- a/project/templates/base.html +++ b/project/templates/base.html @@ -3,14 +3,17 @@ - {% block title %}Platforma Redakcyjna{% endblock %} + {% block title %}Platforma Redakcyjna{% block subtitle %}{% endblock subtitle %}{% endblock title%} {% block extrahead %} {% endblock %} - + {% block maincontent %} {% endblock %} diff --git a/project/templates/registration/head_login.html b/project/templates/registration/head_login.html new file mode 100644 index 00000000..d6df7fe7 --- /dev/null +++ b/project/templates/registration/head_login.html @@ -0,0 +1,6 @@ +{% if user.is_authenticated %} +{{ user.get_full_name }} | +Wyloguj +{% else %} +Logowanie +{% endif %} diff --git a/project/templates/registration/login.html b/project/templates/registration/login.html new file mode 100644 index 00000000..8bf89675 --- /dev/null +++ b/project/templates/registration/login.html @@ -0,0 +1,15 @@ +{% extends "base.html" %} + +{% block subtitle %} - Logowanie {% endblock subtitle %} + +{% block maincontent %} + +
+
+{{ form.as_p }} +

+ +
+
+ +{% endblock maincontent %} diff --git a/project/urls.py b/project/urls.py index cc433c05..1ba97d65 100644 --- a/project/urls.py +++ b/project/urls.py @@ -7,7 +7,7 @@ admin.autodiscover() urlpatterns = patterns('', - # Example: + # Explorer: url(r'^$', 'explorer.views.file_list', name='file_list'), url(r'^file/(?P[^/]+)/$', 'explorer.views.file_xml', name='file_xml'), url(r'^images/(?P[^/]+)/$', 'explorer.views.folder_images', name='folder_image'), @@ -21,6 +21,10 @@ urlpatterns = patterns('', # Admin panel url(r'^admin/doc/', include('django.contrib.admindocs.urls')), url(r'^admin/(.*)', admin.site.root), + + # Authorization + url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'redirect_field_name': 'next_page'}), + url(r'^accounts/logout$', 'django.contrib.auth.views.logout', {'next_page': '/'}), # {'redirect_field_name': 'next_page'}), ) diff --git a/redmine/redmine_publications/app/controllers/publications_controller.rb b/redmine/redmine_publications/app/controllers/publications_controller.rb index bb74d03f..a9d7c15a 100644 --- a/redmine/redmine_publications/app/controllers/publications_controller.rb +++ b/redmine/redmine_publications/app/controllers/publications_controller.rb @@ -13,16 +13,29 @@ class PublicationsController < ApplicationController end def refresh + @match_status = [] + regexp = Regexp.new(Setting.plugin_redmine_publications[:pattern]) Repository.all.each do |repo| + repo_status = [] repo.entries.each do |entry| match = entry.path.match(regexp) if match Publication.find_or_create_by_name(:name => match[1], :source_file => entry.path, :repository_id => repo.id) - end + repo_status += [{:path => entry.path, :match => match[1], :matched => true}] + else + repo_status += [{:path => entry.path, :match =>nil, :matched => false}] + end end + @match_status += [{:repo => repo, :status => repo_status}] end + + respond_to do |format| + format.html + format.xml { render :xml => @match_status} + format.json { render :json => @match_status } + end end def issues diff --git a/redmine/redmine_publications/app/views/publications/index.html.erb b/redmine/redmine_publications/app/views/publications/index.html.erb index 9a7e3ce0..3fa02993 100644 --- a/redmine/redmine_publications/app/views/publications/index.html.erb +++ b/redmine/redmine_publications/app/views/publications/index.html.erb @@ -1,4 +1,5 @@

Publikacje

+

Odśwież listę publikacji

    <% @publications.each do |pub| %>
  1. <%= pub.name %>
  2. diff --git a/redmine/redmine_publications/app/views/publications/refresh.erb b/redmine/redmine_publications/app/views/publications/refresh.erb new file mode 100644 index 00000000..1968a926 --- /dev/null +++ b/redmine/redmine_publications/app/views/publications/refresh.erb @@ -0,0 +1,14 @@ +<% @match_status.each do |repo_status| %> +

    Repozytorium: <%= repo_status[:repo].url %>

    + + + +<% repo_status[:status].each do |status| %> + + + + + +<% end %> +
    Ścieżka zasobuRozpoznanoID zasobu
    <%= status[:path] %><%= (status[:matched] && 'Tak') || 'Nie' %><%= status[:match] || '' %>
    +<% end %> diff --git a/redmine/redmine_publications/app/views/settings/_publications_settings.html.erb b/redmine/redmine_publications/app/views/settings/_publications_settings.html.erb index 626e5c62..0465535a 100644 --- a/redmine/redmine_publications/app/views/settings/_publications_settings.html.erb +++ b/redmine/redmine_publications/app/views/settings/_publications_settings.html.erb @@ -1,4 +1,4 @@ -<% @tracker = Tracker.find(@settings['tracker']) %> +<% @tracker = Tracker.find(@settings[:tracker] || 1) %>

    @@ -8,6 +8,6 @@

    - <%= text_field_tag 'settings[pattern]', @settings['pattern'] %> + <%= text_field_tag 'settings[pattern]', @settings[:pattern] || '' %>