Merge branch 'master' of git@stigma.nowoczesnapolska.org.pl:platforma
authorzuber <marek@stepniowski.com>
Tue, 25 Aug 2009 15:09:01 +0000 (17:09 +0200)
committerzuber <marek@stepniowski.com>
Tue, 25 Aug 2009 15:09:01 +0000 (17:09 +0200)
1  2 
apps/explorer/views.py
project/static/css/master.css
project/templates/explorer/file_xml.html

diff --combined apps/explorer/views.py
@@@ -5,7 -5,7 +5,7 @@@ from django.utils import simplejson as 
  from django.views.generic.simple import direct_to_template
  
  from django.conf import settings
- from django.http import HttpResponseRedirect
+ from django.http import HttpResponseRedirect, HttpResponse
  from django.contrib.auth.decorators import login_required
  
  from explorer import forms, models
@@@ -21,15 -21,19 +21,19 @@@ def file_xml(request, path)
      if request.method == 'POST':
          form = forms.BookForm(request.POST)
          if form.is_valid():
-             repo.add_file(path, form.cleaned_data['text'])
+             # save the changes to a local branch
+ #           repo.write_lock()
+             print request.user
+ #            repo.switch_to_branch(request.user.name)           
+ #            repo.add_file(path, form.cleaned_data['text'])
              
              # add references to comment
              issues = _get_issues_for_file(path)
              commit_message = _add_references(form.cleaned_data['commit_message'], issues)
              print 'Commiting with: ' + commit_message
  
-             repo.commit(message=commit_message, user=form.cleaned_data['user'])
-             return HttpResponseRedirect(request.get_full_path())
#            repo.commit(message=commit_message, user=form.cleaned_data['user'])
+         return HttpResponse( json.dumps({'message': commit_message}) )
      else:
          form = forms.BookForm()
          form.fields['text'].initial = repo.get_file(path).data()
@@@ -65,30 -69,11 +69,30 @@@ def htmleditor_panel(request, path)
      })
   
  
 +def dceditor_panel(request, path):
 +    if request.method == 'POST':
 +        form = forms.DublinCoreForm(request.POST)
 +        if form.is_valid():
 +            form.save(repo, path)
 +            repo.commit(message='%s: DublinCore edited' % path)
 +    else:
 +        text = repo.get_file(path).data()
 +        form = forms.DublinCoreForm(text=text)       
 +
 +    return direct_to_template(request, 'explorer/panels/dceditor.html', extra_context={
 +        'form': form,
 +    })
 +
 +
 +# =================
 +# = Utility views =
 +# =================
  def folder_images(request, folder):
      return direct_to_template(request, 'explorer/folder_images.html', extra_context={
          'images': models.get_images_from_folder(folder),
      })
  
 +
  def _add_references(message, issues):
      return message + " - " + ", ".join(map(lambda issue: "Refs #%d" % issue['id'], issues))
  
@@@ -1,26 -1,31 +1,31 @@@
  body {
      margin: 0;
-     font: 14px Helvetica, Verdana, sans-serif;
+     font: 10pt Helvetica, Verdana, sans-serif;
      overflow: hidden;
  }
  
  #header { 
      position: relative;
-     padding: 2px 0.5em;
+     padding: 0.2em 0.5em;
      background-color: #CDCDCD;
        border-bottom: 1px solid black;
-       clear: both;
+       height: 1.8em;
+       line-height: 1.8em;
+       vertical-align: center;
  }
  
  #header #breadcrumbs {
  }
  
- #header #login_info {
+ #header-right-toolbar {
        position: absolute;
        right: 1em;
  }
  
+ #header button {
+       vertical-align: center;
+ }
  ul {
      margin: 20px;
      padding: 0;
@@@ -91,7 -96,7 +96,7 @@@ label 
  
  #panels {
        position: absolute;
-       bottom: 0px; left: 0px; right: 0px; top: 50px;
+       bottom: 0px; left: 0px; right: 0px; top: 1em;
  }
  
  .panel-wrap {
      cursor: default;
  }
  
 +/* =========================== */
 +/* = DublinCore Editor panel = */
 +/* =========================== */
 +.panel-dceditor {
 +    padding: 10px;
 +}
 +
 +.panel-dceditor label {
 +    font-size: 12px;
 +    margin-top: 10px;
 +    color: #666;
 +    font-weight: bold;
 +}
 +
 +.panel-dceditor input, .panel-dceditor textarea {
 +    width: 400px;
 +}
  
  div.isection {
        margin: 1em auto;
@@@ -7,10 -7,14 +7,14 @@@
      <script src="/static/js/jquery.wtooltip.js" type="text/javascript" charset="utf-8"></script>
      <script src="/static/js/jquery.hpanel.js" type="text/javascript" charset="utf-8"></script>
      <script src="/static/js/panels.js" type="text/javascript" charset="utf-8"></script>
+     <script src="/static/js/save-commit.js" type="text/javascript" charset="utf-8"></script>
  {% endblock extrahead %}
  
  {% block breadcrumbs %}<a href="{% url file_list %}">Platforma Redakcyjna</a> ❯ plik {{ hash }}{% endblock breadcrumbs %}
  
+ {% block header-toolbar %}
+       <button type="button" class="toolbar-button" id="toolbar-button-save">Zapisz</button>
+ {% endblock %}
  {% block maincontent %}
          <div id="panels">
              <div id="left-panel-wrap" class="panel-wrap">
                      <select name="select-left-panel" id="select-left-panel">
                          <option value="{% url xmleditor_panel hash %}">Edytor XML</option>
                          <option value="{% url htmleditor_panel hash %}">Edytor HTML</option>
 -                        <option value="{% url gallery_panel hash %}">Galeria skanów</option>    
 +                        <option value="{% url gallery_panel hash %}">Galeria skanów</option>
 +                        <option value="{% url dceditor_panel hash %}">Edytor DublinCore</option>
                      </select>
                      <strong class="change-notification" style="display: none">Zmieniono!</strong>
                 </div>
                 <div id="left-panel-content" class="panel-content"></div>
-                <button class="panel-slider" id="slider01">&nbsp;</button>
+                <button type="button" class="panel-slider" id="slider01">&nbsp;</button>
              </div>
              <div id="right-panel-wrap" class="panel-wrap last-panel">
                  <div id="right-panel-toolbar" class="panel-toolbar">
@@@ -34,7 -37,6 +38,7 @@@
                          <option value="{% url xmleditor_panel hash %}">Edytor XML</option>
                          <option value="{% url htmleditor_panel hash %}">Edytor HTML</option>
                          <option value="{% url gallery_panel hash %}">Galeria skanów</option>
 +                        <option value="{% url dceditor_panel hash %}">Edytor DublinCore</option>
                      </select>
                      <strong class="change-notification" style="display: none">Zmieniono!</strong>
                   </div>