Skip to content

Commit

Permalink
Support a more project options
Browse files Browse the repository at this point in the history
  • Loading branch information
dboys committed Jun 21, 2013
1 parent 1ca2738 commit 48c0096
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 9 deletions.
5 changes: 3 additions & 2 deletions app-parrot-create
Expand Up @@ -20,9 +20,10 @@ get '/' => 'index';
post '/' => sub {
my $self = shift;

my ($name, $builder, $harness);
my ($name, $builder, $harness, $with_pmc, $with_ops, $with_doc);
if (defined $self->param("hll")) {
($name, $builder, $harness) = map { $self->param($_) } qw/hll_name hll_builder hll_test/;
($name, $builder, $harness, $with_pmc, $with_ops, $with_doc)
= map { $self->param($_) } qw/hll_name hll_builder hll_test with_pmc with_ops with_doc/;
}
elsif(defined $self->param("lib")){
($name, $builder, $harness) = map { $self->param($_) } qw/lib_name lib_builder lib_test/;
Expand Down
2 changes: 2 additions & 0 deletions lib/Parrot/Base.pm
Expand Up @@ -30,4 +30,6 @@ has 'test_system' => (
default => 'Perl 5'
);

requires 'generate';

1;
10 changes: 10 additions & 0 deletions lib/Parrot/HLL.pm
Expand Up @@ -32,5 +32,15 @@ has 'pod' => (
default => '0'
);

=head2 generate()
Args: none
Returns: zip hll file path
Description:
Generate a new zip hll project
=cut
method generate() {

}

no Moose;
__PACKAGE__->meta->make_immutable;
9 changes: 9 additions & 0 deletions lib/Parrot/Library.pm
Expand Up @@ -7,5 +7,14 @@ use Method::Signatures;

with 'Parrot::Base';

=head2 generate()
Args: none
Returns: zip parrot library file path
Description:Generate a new zip parrot library project
=cut
method generate() {

}

no Moose;
__PACKAGE__->meta->make_immutable;
44 changes: 37 additions & 7 deletions templates/index.html.ep
Expand Up @@ -66,7 +66,7 @@
</div>

<div id="newlang-options" class="well span4 column">
<form action="/" method="post">
<form id="hll_form" action="/" method="post">

<div class="control-group" id="hll-name-group">
<label class="control-label" for="hll_name">HLL Name:</label>
Expand Down Expand Up @@ -101,12 +101,10 @@

<div class="control-group">
<label class="control-label">Options:</label>
<div class="controls">
<div class="btn-group" data-toggle="buttons-checkbox">
<button name="pmc" type="button" class="btn btn-toggle">Custom PMCs</button>
<button name="ops" type="button" class="btn btn-toggle">Custom ops</button>
<button name="pod" type="button" class="btn btn-toggle">Doc templates</button>
</div>
<div class="controls btn-group" data-toggle="buttons-checkbox">
<button id="pmc" name="pmc" value="0" type="button" class="btn btn-toggle">Custom PMCs</button>
<button id="ops" name="ops" value="0" type="button" class="btn btn-toggle">Custom ops</button>
<button id="doc" name="doc" value="0" type="button" class="btn btn-toggle">Doc templates</button>
</div>
</div>

Expand Down Expand Up @@ -152,6 +150,29 @@
var hll_name = false;
var lib_name = false;

var with_pmc = 0;
var with_ops = 0;
var with_doc = 0;

$('#hll_form').submit(function(){
$('<input />').attr('type', 'hidden')
.attr('name', 'with_pmc')
.attr('value', +with_pmc)
.appendTo('#hll_form');

$('<input />').attr('type', 'hidden')
.attr('name', 'with_ops')
.attr('value', +with_ops)
.appendTo('#hll_form');

$('<input />').attr('type', 'hidden')
.attr('name', 'with_doc')
.attr('value', +with_doc)
.appendTo('#hll_form');

return true;
});

$('#hll_name').bind('blur keyup', function() {
$('#hll-msg').html("");
var name = $('#hll_name').val();
Expand Down Expand Up @@ -204,6 +225,15 @@

$('button').click(function () {
$(this).toggleClass("btn-primary");
if ($(this).attr("name") == "pmc") {
with_pmc = !with_pmc;
}
else if ($(this).attr("name") == "ops") {
with_ops = !with_ops;
}
else if ($(this).attr("name") == "doc") {
with_doc = !with_doc;
}
});

function enableDownload(enable,btn_id) {
Expand Down

1 comment on commit 48c0096

@leto
Copy link
Member

@leto leto commented on 48c0096 Jun 23, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Keep up the good work.

Please sign in to comment.