[Jifty-commit] r1446 - jifty/trunk/doc/talks
jifty/trunk/lib/Jifty/Mason jifty/trunk/plugins/EditInPlace
jifty/trunk/plugins/EditInPlace/lib/Jifty/Plugin
jifty/trunk/plugins/EditInPlace/lib/Jifty/Plugin/EditInPlace
jifty/trunk/plugins/EditInPlace/lib/Jifty/Plugin/EditInPlace/Action
jifty/trunk/share/web/static/css
jifty/trunk/share/web/static/images/silk
jifty/trunk/share/web/templates/__jifty
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Sun Jul 2 23:00:46 EDT 2006
Author: jesse
Date: Sun Jul 2 23:00:26 2006
New Revision: 1446
Added:
jifty/trunk/plugins/EditInPlace/share/web/templates/__jifty/create_file_inline
jifty/trunk/plugins/EditInPlace/share/web/templates/__jifty/edit_file_inline
jifty/trunk/share/web/static/images/silk/pencil.png (contents, props changed)
jifty/trunk/share/web/static/images/silk/pencil_add.png (contents, props changed)
Modified:
/ (props changed)
jifty/trunk/doc/talks/yapc.na.2006.xul
jifty/trunk/lib/Jifty/Mason/Halo.pm
jifty/trunk/plugins/EditInPlace/META.yml
jifty/trunk/plugins/EditInPlace/lib/Jifty/Plugin/EditInPlace.pm
jifty/trunk/plugins/EditInPlace/lib/Jifty/Plugin/EditInPlace/Action/FileEditor.pm
jifty/trunk/plugins/EditInPlace/lib/Jifty/Plugin/EditInPlace/Dispatcher.pm
jifty/trunk/share/web/static/css/halos.css
jifty/trunk/share/web/templates/__jifty/halo
Log:
r35731 at truegrounds: jesse | 2006-07-02 21:59:23 -0500
* First pass at letting users edit their application like a Wiki
Modified: jifty/trunk/doc/talks/yapc.na.2006.xul
==============================================================================
Binary files. No diff available.
Modified: jifty/trunk/lib/Jifty/Mason/Halo.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Mason/Halo.pm (original)
+++ jifty/trunk/lib/Jifty/Mason/Halo.pm Sun Jul 2 23:00:26 2006
@@ -28,7 +28,7 @@
my $self = shift;
my $context = shift;
- return if $context->comp->path eq "/__jifty/halo";
+ return if ($context->comp->path && $context->comp->path eq "/__jifty/halo");
Jifty->handler->stash->{ '_halo_index_stack' } ||= [];
@@ -49,9 +49,9 @@
id => $halo_base,
args => [map { eval { defined $_ and fileno( $_ ) } ? "*GLOB*" : $_} @{$context->args}],
start_time => Time::HiRes::time(),
- path => $context->comp->path,
+ path => $context->comp->path || '',
subcomponent => ( $context->comp->is_subcomp() ? 1:0),
- name => $context->comp->name,
+ name => $context->comp->name || '(Unamed component)',
proscribed => ($self->_unrendered_component($context) ? 1 :0 ),
depth => $DEPTH
};
@@ -74,7 +74,7 @@
my $self = shift;
my $context = shift;
- return if $context->comp->path =~ "^/__jifty/halo";
+ return if ($context->comp->path && $context->comp->path =~ "^/__jifty/halo");
my $STACK = Jifty->handler->stash->{'_halo_stack'};
my $INDEX_STACK = Jifty->handler->stash->{'_halo_index_stack'};
@@ -96,7 +96,23 @@
# print out the div with our halo magic actions.
# if we didn't render a beginning of the span, don't render an end
- $context->request->out('</div>') unless ($frame->{'proscribed'});
+ unless ( $frame->{'proscribed'} ) {
+ my $comp_name = $frame->{'path'};
+ $context->request->out('</div>');
+ $context->request->out(
+ Jifty->web->link(
+ label => _( 'Edit %1', $comp_name ),
+ class => 'inline_edit',
+ onclick => [
+ { element => "#halo-" . $frame->{id},
+ replace_with =>
+ '/__jifty/edit_inline/mason_component/'.$comp_name
+ }
+ ]
+ )
+ )
+ if ( $frame->{'path'} and $frame->{'path'} !~ /^\/?__jifty/ );
+ }
}
Modified: jifty/trunk/plugins/EditInPlace/META.yml
==============================================================================
--- jifty/trunk/plugins/EditInPlace/META.yml (original)
+++ jifty/trunk/plugins/EditInPlace/META.yml Sun Jul 2 23:00:26 2006
@@ -1,7 +1,7 @@
build_requires:
ExtUtils::MakeMaker: 6.11
distribution_type: module
-generated_by: Module::Install version 0.620
+generated_by: Module::Install version 0.630
license: unknown
name: Jifty-Plugin-EditInPlace
no_index:
Modified: jifty/trunk/plugins/EditInPlace/lib/Jifty/Plugin/EditInPlace.pm
==============================================================================
--- jifty/trunk/plugins/EditInPlace/lib/Jifty/Plugin/EditInPlace.pm (original)
+++ jifty/trunk/plugins/EditInPlace/lib/Jifty/Plugin/EditInPlace.pm Sun Jul 2 23:00:26 2006
@@ -5,5 +5,30 @@
use base qw/Jifty::Plugin/;
+package HTML::Mason::Request::Jifty;
+
+=head2 fetch_comp
+
+=cut
+
+sub fetch_comp {
+ my $self = shift;
+ my $comp = $self->SUPER::fetch_comp(@_);
+ if (not $comp and Jifty->config->framework('DevelMode') ) {
+ my $comp_name = shift;
+ $comp = $self->interp->make_component(
+ comp_source =>
+ "
+ <span id=\"create-component-$comp_name\">
+<% Jifty->web->link(class => 'inline_create', label => 'Create $comp_name', onclick => [ { element => \"#create-component-$comp_name\", replace_with => '/__jifty/edit_inline/mason_component/$comp_name' } ]) %>
+ </span>
+ ");
+
+
+ }
+ return $comp;
+}
+
+
1;
Modified: jifty/trunk/plugins/EditInPlace/lib/Jifty/Plugin/EditInPlace/Action/FileEditor.pm
==============================================================================
--- jifty/trunk/plugins/EditInPlace/lib/Jifty/Plugin/EditInPlace/Action/FileEditor.pm (original)
+++ jifty/trunk/plugins/EditInPlace/lib/Jifty/Plugin/EditInPlace/Action/FileEditor.pm Sun Jul 2 23:00:26 2006
@@ -74,14 +74,15 @@
my $self = shift;
{ file_type => {
+ label => 'File type',
default => 'mason_component',
render_as => 'Select',
- valid_values => [qw/mason_component library/],
+ valid_values => [{ value => 'mason_component', display => 'Template'} , {value => 'library', display => 'Library'}],
constructor => 1
},
- source_path => { type => 'text', constructor => 1 },
+ source_path => { type => 'text', constructor => 1, label => 'Path' },
destination_path => { type => 'text', ajax_validates=> 1, label => 'Save as' },
- content => { render_as => 'Textarea', cols => 80, rows => 25 },
+ content => { render_as => 'Textarea', cols => 80, rows => 25, label => 'Content' },
}
@@ -161,6 +162,7 @@
my $self = shift;
my $dest = $self->{'write_to'};
+
# discard filename. we only want to make the directory ;)
Jifty::Util->make_path( File::Basename::dirname( $dest ) );
my $writehandle = IO::File->new();
Modified: jifty/trunk/plugins/EditInPlace/lib/Jifty/Plugin/EditInPlace/Dispatcher.pm
==============================================================================
--- jifty/trunk/plugins/EditInPlace/lib/Jifty/Plugin/EditInPlace/Dispatcher.pm (original)
+++ jifty/trunk/plugins/EditInPlace/lib/Jifty/Plugin/EditInPlace/Dispatcher.pm Sun Jul 2 23:00:26 2006
@@ -4,23 +4,24 @@
package Jifty::Plugin::EditInPlace::Dispatcher;
use Jifty::Dispatcher -base;
-before qr'^/__jifty/edit/(.*?)/(.*)$', run {
+before qr'^/__jifty/(edit|create)(_inline/|)/(.*?)/(.*)$', run {
# Claim this as ours -- skip ACLs, etc
last_rule;
};
-on qr'^/__jifty/edit/(.*?)/(.*)$', run {
+on qr'^/__jifty/(edit|create)(_inline|)/(.*?)/(.*)$', run {
my $editor = Jifty->web->new_action(
class => 'Jifty::Plugin::EditInPlace::Action::FileEditor',
moniker => 'editpage',
arguments => {
- source_path => $2,
- file_type => $1,
+ source_path => $4,
+ file_type => $3,
}
);
- set editor => $editor;
- show '/__jifty/edit_file';
+ set editor => $editor;
+ set path => $4;
+ show "/__jifty/$1_file$2";
};
Added: jifty/trunk/plugins/EditInPlace/share/web/templates/__jifty/create_file_inline
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/EditInPlace/share/web/templates/__jifty/create_file_inline Sun Jul 2 23:00:26 2006
@@ -0,0 +1,12 @@
+<%attr>
+edit_inline => 0
+</%attr>
+<%args>
+$path => undef
+$line => undef
+</%args>
+<% Jifty->web->link(label => _("Create $path"),
+ onclick => {
+ replace_with => '/__jifty/edit_inline/mason_component/'.$path,
+ },
+ )%>
Added: jifty/trunk/plugins/EditInPlace/share/web/templates/__jifty/edit_file_inline
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/EditInPlace/share/web/templates/__jifty/edit_file_inline Sun Jul 2 23:00:26 2006
@@ -0,0 +1,14 @@
+<%args>
+$path => undef
+$editor => undef
+$line => undef
+</%args>
+<% Jifty->web->form->start %>
+<%$editor->form_field('destination_path', render_as => 'hidden')%>
+<%$editor->form_field('content')->render_widget%>
+<% Jifty->web->form->submit(label => 'Save', onclick => { submit => $editor,
+ replace_with => $path,
+ },
+
+ submit => $editor )%>
+<% Jifty->web->form->end %>
Modified: jifty/trunk/share/web/static/css/halos.css
==============================================================================
--- jifty/trunk/share/web/static/css/halos.css (original)
+++ jifty/trunk/share/web/static/css/halos.css Sun Jul 2 23:00:26 2006
@@ -99,3 +99,26 @@
right:0.5em;
bottom:0;
}
+
+a.inline_edit {
+
+ display: block;
+ width: 0;
+ padding-left: 22px;
+ min-height: 20px;
+
+ background: no-repeat left center;
+ background: url(/static/images/silk/pencil.png) no-repeat 0 0;
+}
+
+a.inline_create {
+
+ display: block;
+ width: 0;
+ padding-left: 22px;
+ min-height: 20px;
+
+ background: no-repeat left center;
+ background: url(/static/images/silk/pencil_add.png) no-repeat 0 0;
+}
+
Added: jifty/trunk/share/web/static/images/silk/pencil.png
==============================================================================
Binary file. No diff available.
Added: jifty/trunk/share/web/static/images/silk/pencil_add.png
==============================================================================
Binary file. No diff available.
Modified: jifty/trunk/share/web/templates/__jifty/halo
==============================================================================
--- jifty/trunk/share/web/templates/__jifty/halo (original)
+++ jifty/trunk/share/web/templates/__jifty/halo Sun Jul 2 23:00:26 2006
@@ -15,7 +15,7 @@
<li><a href="#" class="halo_comp_info" onmouseover="halo_over('<% $item->{id} %>')"
onmouseout="halo_out('<% $item->{id} %>')"
onclick="halo_toggle('<% $item->{id} %>'); return false;">
-<% $item->{'path'} %> - <% $item->{'render_time'} %></a>
+<% $item->{'name'} %> - <% $item->{'render_time'} %></a>
% unless ($item->{subcomponent}) {
<% Jifty->web->tangent( url =>"/__jifty/edit/mason_component/".$item->{'path'}, label => 'Edit') %>
% }
More information about the Jifty-commit
mailing list