Esempio n. 1
0
 function __construct()
 {
     parent::controllerClass('TemplateSectionItems');
     parent::headerPlural('Template Section Items');
     parent::headerSingular('Template Section Items');
     parent::baseRoute('/admin/templates/{id1}/sections/{id2}/items');
     parent::ajaxBaseRoute('/ajax/admin/templates/{id1}/sections/{id2}/items');
     parent::table(new Item());
     $this->level = 3;
     parent::attributes([['title' => 'ID', 'id' => 'id'], ['title' => 'Name', 'id' => 'name'], ['title' => 'Type', 'id' => 'item_type.name']]);
     parent::inputs(function ($row) {
         $parentId = Request::route("id" . ($this->level - 1));
         return ['section_id' => (new MetaItem())->id('section_id')->defaultValue($parentId), 'name' => (new TextBox())->id('name')->label('Name')->defaultValue($row ? $row->name : ''), 'item_type_id' => (new DropDown())->id('item_type_id')->nullable(false)->label('Type')->idField('id')->nameField('name')->rows(ItemType::get())->defaultValue($row ? $row->item_type_id : '')];
     });
     $this->parentHeader = 'Template Section';
     parent::tableName('item');
 }
Esempio n. 2
0
 function __construct()
 {
     parent::controllerClass('EditPagesAttachments');
     parent::headerPlural('Page Documents');
     parent::headerSingular('Page Document');
     parent::baseRoute('/admin/edit-pages/{id1}/attachments');
     parent::ajaxBaseRoute('/ajax/admin/edit-pages/{id1}/attachments');
     parent::table(new Attachment());
     $this->level = 2;
     parent::attributes([['title' => 'ID', 'id' => 'id'], ['title' => 'Post', 'id' => 'post.name'], ['title' => 'Name', 'id' => 'name'], ['title' => 'Type', 'id' => 'item_type.name']]);
     parent::inputs(function ($row) {
         $parentId = Request::route("id" . ($this->level - 1));
         $page = Page::find($parentId);
         return ['name' => (new TextBox())->id('name')->label('Name')->defaultValue($row ? $row->name : ''), 'post_id' => (new DropDown())->id('post_id')->nullable(true)->label('Post')->idField('id')->nameField('name')->rows(Post::where('page_id', '=', $page->id)->get())->defaultValue($row ? $row->post_id : ''), 'file' => (new FileInput())->id('value')->valueField('value')->label('File')->filename($row ? $row->value : '')->defaultValue($row ? $row->value : ''), 'item_type_id' => (new DropDown())->id('item_type_id')->nullable(false)->label('Type')->idField('id')->nameField('name')->rows(ItemType::whereIn('short_name', ["image", "file"])->get())->defaultValue($row ? $row->item_type_id : '')];
     });
     $this->parentHeader = 'Edit Page';
     parent::tableName('attachment');
 }
 function inputs($post, $att = null)
 {
     $is = [];
     return ['name' => (new TextBox())->id('name')->label('Name')->defaultValue($att ? $att->name : ''), 'post_id' => (new MetaItem())->id('post_id')->defaultValue($post->id), 'file' => (new FileInput())->id('value')->valueField('value')->label('File')->filename($att ? $att->value : '')->defaultValue($att ? $att->value : ''), 'item_type_id' => (new DropDown())->id('item_type_id')->nullable(false)->label('Type')->idField('id')->nameField('name')->rows(ItemType::whereIn('short_name', ["image", "file"])->get())->defaultValue($att ? $att->item_type_id : '')];
 }