Gallery design + some unfinished changes

This commit is contained in:
Piotr Zalewa 2010-02-18 16:03:24 +00:00
Родитель 9aa56ebf69
Коммит 466d97f5f7
8 изменённых файлов: 54 добавлений и 19 удалений

Просмотреть файл

@ -14,4 +14,3 @@ authors:
@import url('UI.File_Listing.css');
@import url('UI.Forms.css');
@import url('UI.Modal.css');
@import url('UI.Browser.css');

Просмотреть файл

@ -23,7 +23,8 @@ var Capability = new Class({
try_in_browser_el: 'try_in_browser',
//edit_url: '',
//update_url: '',
//version_create_url: ''
//version_create_url: '',
is_dependency: false // was the Capability loaded as dependency?
},
/*
* Method: initialize
@ -38,7 +39,10 @@ var Capability = new Class({
this.instantiateEditors();
this.listenToEvents();
this.initializeEditorSwitches();
if (!this.options.is_dependency) {
// TODO: this should probably be moved to the Flightdeck.Editor.js
this.initializeEditorSwitches();
}
this.data = {};
this.data[this.type+'_slug'] = this.options.slug;
@ -52,13 +56,18 @@ var Capability = new Class({
* Method: instantiateEditors
*/
instantiateEditors: function() {
this.description_el = new Editor(this.options.description_el).hide();
fd.editors.push(this.description_el);
// do not create an editor for the description if loaded as dependency
if (! this.options.is_dependency) {
this.description_el = new Editor(this.options.description_el).hide();
fd.editors.push(this.description_el);
}
},
/*
* Method: initializeEditorSwitches
*/
initializeEditorSwitches: function() {
// TODO: this should be done with the event broadcast
// to not bother about new dependencies added
$$('.UI_File_Listing li').each(function(file_el) {
file_el.switch_mode_on = function() {
this.removeClass('UI_File_Normal')
@ -74,11 +83,14 @@ var Capability = new Class({
});
$$('.UI_File_Listing li a').addEvent('click', function() {
this.getParent('li').switch_mode_on();
});;
this.switch_description_el = $(this.options.switch_description_id);
if (this.switch_description_el) {
this.switch_description_el.addEvent('click', this.switchToDescription.bind(this));
}
});
// "there is no spoon" if dependency
if (!this.options.dependency_id) {
this.switch_description_el = $(this.options.switch_description_id);
if (this.switch_description_el) {
this.switch_description_el.addEvent('click', this.switchToDescription.bind(this));
}
}
},
/*
* Method: switchToDescription

Просмотреть файл

@ -0,0 +1,16 @@
<input type="text" name="add_dependency" id="add_dependency"/>
<button id="add_dependecy_action">+</button>
{% with version.capabilities.all as modules %}
{% if modules %}
<ul class="UI_File_Listing">
{% for mod in modules %}
{% if mod %}
<li class="UI_File_Normal" id="{# TODO: mod|dependency_link_id #}">
<a title="" href="#">{{ mod.name }} <span></span></a>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
{% endwith %}

Просмотреть файл

@ -1,13 +1,14 @@
{% extends "base.html" %}
{% load jetpack_extras %}
{% block head %}
<link rel="stylesheet" href="/media/jetpack/css/UI.Browser.css" type="text/css" media="screen" />
{% endblock %}
{% block app_body %}
<ul class="UI_Browser">
{% for item in items %}
<li class="UI_Item">{{ item|render_base_link }}</li>
<li class="UI_Item">{{ item|render_base_link }}</li>
<li class="UI_Item">{{ item|render_base_link }}</li>
<li class="UI_Item">{{ item|render_base_link }}</li>
{% endfor %}
</ul>
{% endblock %}

Просмотреть файл

@ -67,7 +67,7 @@
</a></h3>
<div class="UI_Sidebar_ItemCont">
<ul class="UI_File_Listing">
{% for cap in version.capabilitiesi.all %}
{% for cap in version.capabilities.all %}
<li class="UI_File_Normal" id="{{ cap|dependency_link_id }}">
<a title="" href="#">{{ cap.name }} <span></span></a>
</li>

Просмотреть файл

@ -10,14 +10,20 @@ def tab_link_id(item, value):
slug = item.slug if item else ''
return "%s_%s" % (slug, value)
@register.filter
def dependency_link_id(item):
return "dependency_%s" % item.slug
try:
slug = item.slug
except:
slug = ''
return "dependency_%s" % slug
@register.filter
def recently_modified_link_id(item):
return "modified_%s" % item.slug
slug = item.slug if item else ''
return "modified_%s" % slug
@register.filter
@ -30,6 +36,7 @@ def render_base_link(item):
t = loader.get_template('_gallery_item_link.html')
return mark_safe(t.render(Context(locals())))
@register.simple_tag
def escape_template(template_name):
t = loader.get_template(template_name)

Просмотреть файл

@ -123,7 +123,7 @@ def jetpack_version_update(r, slug, version, counter):
"""
version = get_object_or_404(JetVersion, jetpack__slug=slug, name=version, counter=counter)
# permission check
if not (r.user.id == version.author.id or r.user in r.managers):
if not (r.user.id == version.author.id or r.user in version.jetpack.managers.all()):
return HttpResponseNotAllowed(HttpResponse(""))
version.author = r.user

Просмотреть файл

@ -23,12 +23,12 @@ SECRET_KEY = '_878&mu1t!-d*u^*@l$afwe$p4r(=*$kyyjy37ibf9t8li5#lv'
DEBUG = False
#MEDIA_ROOT = os.path.join(FRAMEWORK_PATH, 'flightdeck/media/')
MEDIA_ROOT = os.path.join(FRAMEWORK_PATH, 'flightdeck/media/')
ADMIN_MEDIA_ROOT = os.path.join(FRAMEWORK_PATH, 'flightdeck/adminmedia/')
#MEDIA_URL = '/sitemedia/'
#MEDIA_SERVER = ''
#ADMIN_MEDIA_PREFIX = ''.join([MEDIA_SERVER,'/adminmedia/'])
# dot command path (for the graphviz app)
GRAPHVIZ_DOT_CMD = '/usr/bin/dot'
#GRAPHVIZ_DOT_CMD = '/usr/bin/dot'