PageRenderTime 323ms CodeModel.GetById 161ms app.highlight 5ms RepoModel.GetById 156ms app.codeStats 0ms

/halogy/application/modules/blog/views/admin/categories.php

https://bitbucket.org/haloweb/halogy-1.0/
PHP | 85 lines | 64 code | 21 blank | 0 comment | 1 complexity | 27d605be5d20600ac8ae0fd9a4d706df MD5 | raw file
 1<script type="text/javascript">
 2function setOrder(){
 3	$.post('/admin/blog/order/cat',$(this).sortable('serialize'),function(data){ });
 4};
 5
 6function initOrder(el){
 7	$(el).sortable({ 
 8		axis: 'y',
 9	    revert: false, 
10	    delay: '80',
11	    opacity: '0.5',
12	    update: setOrder
13	});
14};
15
16$(function(){
17	$('a.toggle').click(function(event){ 
18		event.preventDefault();		
19		$('div.hidden').slideToggle('400');
20	});
21
22	$('a.edit').click(function(event){
23		event.preventDefault();
24		$(this).parent().siblings('.col1').children('input').show();
25		$(this).parent().siblings('.col1').children('span').hide();
26	});
27
28	initOrder('ol.order');
29});
30</script>
31
32<h1 class="headingleft">Blog Categories</h1>
33
34<div class="headingright">
35	<a href="/admin/blog/viewall" class="button blue">View Posts</a>
36	<a href="#" class="toggle button blue">Add Category</a>
37</div>
38
39<div class="clear"></div>
40
41<div class="hidden">
42	<form method="post" action="<?php echo $this->uri->uri_string(); ?>" class="default">
43	
44		<label for="categoryName">Category name:</label>
45		
46		<?php echo @form_input('catName',$blog_cats['catName'], 'class="formelement" id="catName"'); ?>
47			
48		<input type="submit" value="Add Category" id="submit" class="button" />
49
50		<br class="clear" />
51		
52	</form>
53</div>
54
55<?php if ($categories): ?>
56
57<form method="post" action="/admin/blog/edit_cat/">
58
59	<ol class="order">
60	<?php foreach ($categories as $category): ?>
61		<li id="blog_cats-<?php echo $category['catID']; ?>">
62			<div class="col1">
63				<span><strong><?php echo $category['catName']; ?></strong> <small>(<?php echo url_title(strtolower(trim($category['catName']))); ?>)</small></span>
64				<?php echo @form_input($category['catID'].'[catName]', $category['catName'], 'class="formelement hide" title="Category Name"'); ?><input type="submit" class="button hide" value="Edit" />
65			</div>
66			<div class="col2">
67				&nbsp;
68			</div>
69			<div class="buttons">
70				<a href="#" class="edit"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_edit.png" alt="Edit" /></a>
71				<a href="/admin/blog/delete_cat/<?php echo $category['catID']; ?>" onclick="return confirm('Are you sure you want to delete this?')"><img src="<?php echo $this->config->item('staticPath'); ?>/images/btn_delete.png" alt="Delete" /></a>
72			</div>
73			<div class="clear"></div>
74		</li>
75	<?php endforeach; ?>
76	</ol>
77
78</form>
79
80<?php else: ?>
81
82<p>No blog categories have been created yet.</p>
83
84<?php endif; ?>
85