digideskio / zotonic

Automatically exported from code.google.com/p/zotonic
0 stars 0 forks source link

Restructuring the admin includes #104

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
We'd like to make the admin better:

 - cleaner interface
 - more generic templates (e.g., less code to override/adjust stuff)
 - easier way to setup listviews (sortable etc)

Original issue reported on code.google.com by scherpenisse on 6 Sep 2010 at 4:16

GoogleCodeExporter commented 8 years ago
I have already finsihed The basics. After my holiday I will continue. 

Original comment by tbenn...@gmail.com on 6 Sep 2010 at 6:29

GoogleCodeExporter commented 8 years ago
Is any progress here?

I have an idea to break mod_admin/templates/admin_edit.tpl into small 
admin_edit.tpl and widgets. And create a one shared widget templates 
"admin_widget_edit.tpl" and "admin_widget_dashboard.tpl".

admin_edit.tpl includes every widget using this simple construction:
{% include "_widget_edit_body.tpl" title="Body" %}
or, anothen example:
{% include "_widget_edit_body.tpl" title="Body" minified 
content_class="admin-form" %}

And every real widget is .tpl-file with structure:
{% extends "admin_widget_edit.tpl" %}
{% block widget_title %} Body {% endblock %}
{% block widget_content %} ...stuff... {% endblock %}

So, anyone can simply create a widget by extending admin_widget_edit.tpl and 
writing _only_real_widget_content, abstracting far from borders, captions etc.

I've attached some files, so you can see the source code of idea.

- widget_edit.tpl - extendable skeleton for admin_edit widgets

- _widget_body.tpl - is widget. It shows body-editting tinyMCE by including it:
  {% include "_widget_body.tpl" %}

- _widget_publication_period.tpl - widget. Minified by default
  {% include "_widget_publication_period.tpl" title=_"Publication period" minified="true" %}

- _widget_publish_page.tpl - ~isolated widget with buttons "save", "delete", 
"publish", etc. Should be included with:
  {% include "_widget_publish_page.tpl" titlebar="simple" widget_id="sort-publish" %}

- widget_dashboard.tpl - draft for dashboard widgets.

You can see, that visually in browser everything looks unchanged.
If you interested in this way admin-template-breaking, I will continue this 
work. If you have any suggestions, please do not hesitate to write it here :)

wbr, 
Konstantin.

Original comment by hellla...@gmail.com on 14 Mar 2011 at 11:41

Attachments:

GoogleCodeExporter commented 8 years ago
I have been busy the past few days but will look into this tonight or tomorrow.
grts Arjan

Original comment by scherpenisse on 16 Mar 2011 at 1:13

GoogleCodeExporter commented 8 years ago
I really like this idea.

The admin has been suffering for a long time from code duplication due to the 
way every edit box was constructed. I'm really in favor of generalizing this.

It would break old admin overrides, however, for instance if you have a custom 
_admin_edit_content.categoryname.tpl; maybe we can stil make these wor by 
reusing the existing template includes.

I would say: go for it! Maybe make a git clone and push your changes there so 
we (I) can track the progress.

Thanks for taking this on you :)

Original comment by scherpenisse on 17 Mar 2011 at 7:53

GoogleCodeExporter commented 8 years ago

Original comment by scherpenisse on 17 Mar 2011 at 7:54

GoogleCodeExporter commented 8 years ago
First good news: i've started big work yesterday and got a big progress. I've 
done 1st commit in own repo. You can pull it using:
hg pull 'http://vedro.su:9000'

By now i've successfully ported to new infastructure several main edit 
templates: _admin_edit_basics.tpl, _admin_edit_body.tpl, 
_admin_edit_content.*.tpl.

They all working ok right now!

By now, there are two (2) parent widget templates: admin_edit_widget_std.tpl 
and admin_edit_widget_i18n.tpl for i18n tabs.

I will add third parent widget template admin_edit_widget_dashboard.tpl in next 
commits, when it will be ready.

Original comment by hellla...@gmail.com on 20 Mar 2011 at 12:12

GoogleCodeExporter commented 8 years ago
I looked at the patch and it's really nice!
2 things I found:
 - the tabs don't have a frame around them, making the i18n widget look kinda strange (see screenshot)
 - the background of the publish widget should be dark gray (like it was before)

Original comment by scherpenisse on 24 Mar 2011 at 10:43

GoogleCodeExporter commented 8 years ago
Hi, Arjan. I've fixed this two visual problems in admin_edit.tpl. 
Also, admin.tpl is splitted to simple widgets.
I near the finish, but we need to fix regression in js. Go to /admin/overview 
and press "make new page" -- endless error message occurs. 

I'm not skilled in js, so i need some help. The regression is come when i've 
edited admin_base.tpl: moved {% include "_js_include_jquery.tpl" %} from <body> 
tail to <head>. This movement is really needed for proper widgets 
initialization in admin_edit.tpl.

Also, I'm planning to write documentation and several examples next days.

Original comment by hellla...@gmail.com on 27 Mar 2011 at 7:35

GoogleCodeExporter commented 8 years ago
Cool :-D

I'll look at the javascript issue. I agree that adding jquery to the top of the 
page is better, so we should go that route indeed.

Original comment by scherpenisse on 28 Mar 2011 at 3:46

GoogleCodeExporter commented 8 years ago
I've committed several readmes and widget examples at 
http://vedro.su:9000/rev/e1e1fc9c9df1

Original comment by hellla...@gmail.com on 4 Apr 2011 at 6:18

GoogleCodeExporter commented 8 years ago
I fixed the location editing page with the google maps.
Did not experience the "endless error" when pressing the "make new page" button.
jQuery is now in the top, which works fine as far as I can see.
I integrated your commits into the default branch. Thanks for this big 
contribution!

Original comment by scherpenisse on 5 Apr 2011 at 6:46