This what happens when I put translation:
# translations/messages.en.yaml
Post: Posts
easy_admin:
entities:
Post:
class: App\Entity\Post
list:
fields:
- { property: 'title', label: 'post.title' }
- { property: 'post', label: 'post.content' }
In the side menu I need it as Posts and in the create page as Create post. Can't find how to translate these.
Related
I use Easyadmin bundle for the administrative part of the web-application and I use configuration like this:
easy_admin:
entities:
Payment:
class: App\Entity\Payment
controller: App\Controller\CompanyController
label: 'payments'
list:
item_permission: ['ROLE_ADMIN','ROLE_COMPANY_OWNER','ROLE_COMPANY_ACCOUNTANT']
actions: ['show', '-delete', '-edit', '-new']
collapse_actions: true
title: 'Payments'
filters:
- { property: 'id', label: 'id' }
- { property: 'type', label: 'type' }
- { property: 'user', label: 'user' }
...
The problem is about I can't set filter via entity relation, like { property: 'user.company', label: 'company' }, it throws exception that property does not exist or misconfigurated. Does anybody have any idea how to solve this?
you can use Static Filters (dql_filter Option)
The dql_filter option lets you define the conditions passed to the WHERE clause of the Doctrine query used to get the entities displayed in the list and search views.
for exemple
easy_admin:
entities:
VipCustomers:
class: App\Entity\User
list:
dql_filter: 'entity.budget > 100000'
RegularCustomers:
class: App\Entity\User
list:
dql_filter: 'entity.budget <= 100000'
and in your case i think you can do something like this.
easy_admin:
entities:
Payment:
class: App\Entity\Payment
controller: App\Controller\CompanyController
label: 'payments'
list:
item_permission: ['ROLE_ADMIN','ROLE_COMPANY_OWNER','ROLE_COMPANY_ACCOUNTANT']
actions: ['show', '-delete', '-edit', '-new']
collapse_actions: true
title: 'Payments'
dql_filter: "user.company"
I have blog posts categorised as 'jobs' within wordpress posts.
I want to create pages from posts that have category 'jobs'.
I think this is a good use case for templates:
templates: {
WordPressPost: [
{
name: 'jobs',
path: '/jobs/job-blog/:slug',
component: './src/templates/Blogs.vue'
}
],
}
but this will create pages from all of the posts not just the one with category 'jobs'.
Is there a way to conditionally create pages from posts with a certain category?
I'm thinking something like:
WordPressPost: [
{
name: 'jobs',
path: (node) => {
if (node.category === 'jobs') {
return `/jobs/job-blog/${node.slug}`
}
},
component: './src/templates/Blogs.vue'
}
]
This fails
Error: Duplicate key for property path: /
Seems like it's generating other pages at root?
Many thanks!
Context : I want my users to be able to moderate my themes. I created a role moderator, and added a "moderation" (array) field to my user. Therefore, I can give rights to a specific user to one or more Themes.
I'm creating a Back Office to manage users using EasyAdmin & Symfony4.
I want to have a multiple select field displaying my available theme to give rights to users.
Here is my current configuration of easy admin :
User:
class: App\Entity\User
disabled_actions: ['new']
edit:
fields:
- username
- email
- { property: 'roles', type: 'choice', type_options: { multiple: true, choices: { 'ROLE_USER': 'ROLE_USER', 'ROLE_MODERATOR': 'ROLE_MODERATOR', 'ROLE_ADMIN': 'ROLE_ADMIN' } } }
- { property: 'moderate', type: 'entity', type_options: { class: 'App\Entity\Theme', multiple: true } }
Things are going pretty well, since I'm able to edit my user, give him a role, and give him sites to moderate.
The issue :
The current state of my "moderate" array is not displayed. The select doesn't have the current value displayed when showing up.
hai all,
i want to display datas from json store without using list....
then in url i want increment the page number...
i have following code in jsonstore....
Ext.regModel('message',{fields:['Drugid','Drugname','Manufacturer','Price','Unit','Catid']});
var store=new Ext.data.Store({
model: 'message',
proxy: {
type: 'ajax',
url: 'http://174.36.149.186/Medical/api/drugapi.php?op=mdrug&page=1',---- here i give just page is one,i want increment the page number
reader: {
type: 'json',
root: 'result.message'
}
},
autoLoad: true
});
i'm also new to sencha but maybe you could define an item template and add the template to a view just as you would eg. a textbox. the item template is declared just like an object and then passed to the view as the value of the itemtpl config attribute.
http://www.sencha.com/blog/dive-into-dataview-with-sencha-touch-2-beta-2/
This may be obvious but I can't figure out how to bind a static json object to to a FormPanel in extjs. I am new to ExtJs so I'm still learning. I have a TreePanel with various additional attributes contained on the node.attributes object. When a node is clicked id like to display the data in a form. Below is what I have. The data does not get bound to the fields.
All the examples for extjs cover loading data from a store or a url.
tree.on('click', function (n) {
var detailEl = details.body;
if (n.attributes.iconCls == 'page') {
detailEl.hide();
var form = new Ext.FormPanel({
frame: true,
renderTo: detailEl,
title: 'Page Details',
bodyStyle: 'padding:5px 5px 0',
width: 350,
defaults: { width: 230 },
defaultType: 'textfield',
data: n.attributes,
items: [{
fieldLabel: 'Title',
name: 'title',
allowBlank: false
}, {
fieldLabel: 'Url',
name: 'url',
allowBlank: false
}, {
fieldLabel: 'Live',
name: 'islive',
xtype: 'checkbox'
}
],
buttons: [{
text: 'Save'
}]
});
detailEl.slideIn('l', { stopFx: true, duration: .2 });
}
});
Also is it best practise to create a new FormPanel each time or to rebind the existing formPanel?
Thanks,
Ian
The best practice is to have the form rendered once and change the values according to the nodes selected.
As already mentioned, data isn't the field to use. To assign values in a bulk manner, you should use Ext.form.BasicForm.setValues( Array/Object values ) method. You are getting BasicForm object using FormPanel's getForm() method.
Summarizing,
var form = new Ext.FormPanel({/*...*/});
tree.on('click', function (node){
form.getForm().setValues(node.attributes);
});
Pay attention, that form fields' names and attributes' names should correspond.
I don't believe the data configuration key does what you think it does.
Try setting values individually in the field definitions.