Created
February 26, 2015 16:30
-
-
Save sebastianclay/c78df095091f57d42f00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{def $attribute_base='ContentObjectAttribute'} | |
{def $my_profile = fetch( 'content', 'node', | |
hash( 'node_id', 125))} | |
<div class="page-header text-center"> | |
<h2>{'Create/edit object'|i18n('design/myproject/common')}</h2> | |
</div> | |
<span class="ac-small text-center"></span> | |
<div class="col-lg-offset-3 col-lg-6 col-md-offset-2 col-md-8 col-sm-offset-1 col-sm-10"> | |
<form id="object-edit" enctype="multipart/form-data" method="post" action={concat("/content/edit/",$object.id,"/",$edit_version,"/",$edit_language|not|choose(concat($edit_language,"/"),''))|ezurl}> | |
{include uri="design:content/edit_validation.tpl"} | |
{def $attribute = array() | |
$maxlength = 160 } | |
{set $attribute=$object.data_map.name} | |
<div class="form-group"> | |
<label for="{$attribute_base}_ezstring_data_text_{$attribute.id}">{$attribute.contentclass_attribute_name}:</label> | |
<div class="input-group"> | |
<input class="form-control" type="text" name="{$attribute_base}_ezstring_data_text_{$attribute.id}" size="16" value="{$attribute.content|wash()}" placeholder="{$attribute.contentclass_attribute_name}" /> | |
<span class="input-group-addon">{if $attribute.is_required}<span class="glyphicon glyphicon-asterisk small text-danger ac-text-sm"></span>{/if}</span> | |
</div> | |
</div> | |
{set $attribute=$object.data_map.text} | |
<div class="form-group"> | |
<label for="{$attribute_base}_{$attribute.id}">{$attribute.contentclass_attribute_name}:</label> | |
<div class="input-group"> | |
<textarea maxlength="{$maxlength}" class="form-control noresize" name="{$attribute_base}_data_text_{$attribute.id}" rows="{$attribute.contentclass_attribute.data_int1}">{$attribute.content|wash}</textarea> | |
<span class="input-group-addon"> | |
<span class="glyphicon {if $attribute.is_required}glyphicon-asterisk{/if} small text-danger ac-text-sm">{if $attribute.is_required|not} {/if}</span> | |
</span> | |
</div> | |
<small>(Maximum characters: {$maxlength})</small><br/> | |
<small>You have <input type="text" value="{$maxlength}" size="3" id="countdown" name="countdown" readonly=""> characters left.</small> | |
{literal} | |
<script type="text/javascript"> | |
var maxLength = {/literal}{$maxlength}{literal}; | |
$(document).ready(function() { | |
$('textarea').bind("keyup", function() { | |
var length = $(this).val().length; | |
var length = maxLength-length; | |
$('#countdown').val(length); | |
if(length < 20) { | |
$('#countdown').css("color","red"); | |
} else { | |
$('#countdown').css("color","#333"); | |
} | |
}); | |
$('textarea').trigger("keyup"); | |
}); | |
</script> | |
{/literal} | |
</div> | |
{set $attribute=$object.data_map.image} | |
<div class="form-group"> | |
<label for="{$attribute_base}_{$attribute.id}">{$attribute.contentclass_attribute_name}:</label> | |
{attribute_edit_gui attribute=$attribute} | |
</div> | |
<input type="hidden" name="DiscardConfirm" value="0" /> | |
<input type="hidden" name="RedirectIfDiscarded" value={$my_profile.url_alias|ezurl()} /> | |
<input type="hidden" name="RedirectURIAfterPublish" value={$my_profile.url_alias|ezurl()} /> | |
<input class="btn btn-danger" type="submit" name="PublishButton" value="{'Publish'|i18n('design/standard/content/edit')}" /> | |
<input class="btn btn-info" type="submit" value="{'Save'|i18n('design/standard/content/edit')}" name="StoreExitButton"> | |
<a class="btn btn-warning" href={$my_profile.url_alias|ezurl()}>{'Cancel'|i18n('design/standard/content/edit')}</a> | |
</form> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment