I would like to duplicate the "Projects" section so that I have Projects and Portfolio sections. I have duplicated the home/projects.md file and made it home/portfolio.md. I have also created a subfolder content/portfolio just like content/project. However, on my main page, while I do have a section called "Portfolio", it just reproduces what is in the projects folder and ignores what is in the portfolio folder.
Here is the head matter of portfolio.md
+++
# A Projects section created with the Portfolio widget.
widget = "portfolio" # See https://sourcethemes.com/academic/docs/page-builder/
headless = true # This file represents a page section.
active = true # Activate this widget? true/false
weight = 80 # Order that this section will appear.
title = "Portfolio"
subtitle = ""
[content]
# Page type to display. E.g. project.
page_type = "project"
How can I get this section to be separate and read files from the portfolio subfolder? A second, perhaps more complicated question is if it is possible to also have a separate tag taxonomy from the projects? But, that is obviously not my primary concern.
Regarding the first question, the created 'Portfolio' widget will look in the project folder because the page_type is defined as project. Change the page_type to the name of the folder you require i.e. portfolio.
page_type is not a very intuitive name for the folder definition, but that's the way it is!
Related
I'm new here :) I'm trying to build an eCommerce site using Saleor as the framework, I'm having trouble understanding the framework with the intention to modify the admin dashboard and database.
To start simple and practice, I'm trying to add a 'Job Title' field to customers, and want this to be editable on the dashboard.
Currently, I've performed a django migration and the new field is liked up to the database - I modified /saleor/saleor/account/modles.py
class User(PermissionsMixin, AbstractBaseUser):
...
job_title = models.CharField(max_length=256, blank=True)
PostgreSQL also works fine
SELECT * FROM account_user;
SQL Output
Where I'm completely stuck is actually getting this field to work with the dashboard/ appear.
I've gone through editing the files where 'First Name' field appears, as the django /templates/ file seems to reference a 'form' I can only assume is run by ReactJS (which I'm not as familiar with as Python).
The files I've modified (and effectively copied what existed for 'First Name') are:
added jobTitle: formData.jobTitle, to line 111 on static/dashboard-next/customers/views/CustomerDetails.tsx
added block from line 128 on static/customers/components/CustomerDetails/CustomerDetails.tsx
added block from line 24 and 61 on static/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
I'd really appreciate if someone can help point me in the right direction of how saleor / django / reactjs goes from website -> actual html :)
Thanks!
I'm creating a document with rmarkdown (pandoc), which includes some bibliography in a .bib file. What I'd like to do is add a link to the title of the references, so that each of them links to a page of the form http://sample.com/citation-key.html, like this:
Author. (2017). Sample Title. Journal, 1(1), 1–2.
I've tried modifying the .csl file by adding prefixes and suffixes to the title, but everything I put in there is escaped, whether I use markdown or HTML syntax. Unfortunately, I can't change the .bib file. The relevant part of the .csl file is this:
<text variable="title"/>
Sample files are:
literature.Rmd:
---
output: html_document
bibliography: literature.bib
csl: literature.csl
---
#author2017word says this doesn't work.
## References
literature.bib
#article{author2017word,
author = {Author},
journal = {Journal},
number = {1},
pages = {1--2},
title = {{Sample Title}},
volume = {1},
year = {2017}
}
literature.csl: I'm using the APA style from here (line 231).
My pull request to citeproc adding support this feature was recently merged, and as a result, the latest release of Pandoc (v2.14.2) now hyperlinks titles by default when the citation does not already show a raw URL! From the citeproc readme:
When linkBibliography=True automatically linkifies any identifiers (DOI, PMCID, PMID, or URL) appearing in a bibliography entry. When an entry has a DOI, PMCID, PMID, or URL available but none of these are rendered by the style, add a link to the title (or, if no title is present, the whole entry), using the URL for the DOI, PMCID, PMID, or URL (in that order of priority). See Appendix VI of the CSL v1.0.2 spec.
In pandoc, this option is controlled by the link-bibliography metadata field, which is True by default.
My client wants to edit the css files of the site from django admin.
Is there any way to do it ? .
Basically what they want is,to be able to change the color,font etc of the data in the front end from django admin interface.
The best thing would be to just let him edit the css file itself. CSS is, in essence, a rather flexible tool, so writing a way to manage it is rather tough (and really, overkill). It's already easy to pick-up, and any nice editor like sublime or notepad++ would probably be easier and more natural than whatever you'll build using the admin site. Also, by building a simple way to control css, your client will probably start asking for more and more flexibility until you find yourself building an entire cms (trust me, I've been there myself).
What's more, your client probably only wants to manage small aspects or details of the site. Recently I had a project where I allowed my users to style their display of my application. The way I did it was to create a UserDesign model which extended the base User model and kept very specific css data. Something like this:
class UserDesign(models.Model):
user = models.OneToOneField(User)
background_color = models.CharField(max_length=15)
font_color = models.CharField(max_length=20, choices=COLORS)
theme = models.CharField(max_length=20, choices=THEMES)
Meaning, they didn't control the entirety of the css, but they did get to choose the background color and some other information. It's a very neat addition to any website. However, if you are bent over doing it the hard way, I'd do something like this:
class Selector(models.Model):
name = models.CharField(max_length=30)
def get_template(self):
attrs = [a.join() for a in self.attr_set.all()]
return """ %s { %s } """ % ( self.name, ';'.join(attrs) )
class Attr(models.Model):
key = models.CharField(max_length=30)
value = models.CharField(max_length=30)
selector = models.ForeignKey(Selector)
def join(self):
return ': '.join(self.key, self.value)
I chose 30 as the max_length completely arbitrarily (you might need it longer), and you can use a TabularInline to make each selector easy to manage. Then you can easily use different css definitions inside your templates themselves:
<style>
{% for selector in selectors %}
{{ selector.get_template }}
{% endfor %}
</style>
Of course, the Selector model would probably need another field called 'template' or 'view' or something, to link it to a certain html file, though at this point it quickly start devolving into building your own cms (which, as mentioned before, is quite a headache that not wanting to edit a text file just doesn't justify)
A third viable option is to create a view with a code-editor, and just let your client edit his css through the web page. There's more than enough client-side plugins out there, like ace or codemirror (and of course, limit that view to administrators, which very simple to do).
I have a drupal English/French website.
I have a custom content type called 'ad' with all sort of fields.
I have created the file 'node--ad.tpl.php' in my theme directory
to customize the display of the 'ad' content.
I use pixture reloaded theme and DRUPAL 7.
I am trying to translate fields (both labels and values)
by using 'field translation' module.
Field translation works when I CREATE or MODIFY a content via admin.
However, when I DISPLAY a content of type 'ad', fields are not translated.
This is because drupal calls to 'node--ad.tpl.php' and the translation
module is probably not invoked.
When deleting 'node--ad.tpl.php', drupal calls the default node.tpl.php
with a similar results.
Any help would be appreciated,
Thanks in advanced,
Notes :
1 - I correctly activated every dependencies for the module.
2 - User interface translation correctly works.
OK
I found out myself how to do this.
I give the solution here.
It may help for others :
First, translate field labels and values in Configuration > Regional and language > Translate > Import. Do not import values as Fields but as User Interface. Do not specify
an URL (only msgstr and msgid).
Now, you need to add your t() function in the node.tpl.php for the translation to be effective. So :
In the node.tpl.php file, if you want to translate field label, write this :
$content['field_my_field']['#title'] = t($content['field_my_field']['#title']);
Then to translate field value do this :
$content['field_my_field']["#items"][0]['value'] = t($content['field_my_field']["#items"][0]['value']);
You can now render your field : print render($content['field_my_field']);
I want to change how the form looks like and the labels on the fields of the form.
Login in as Admin and then, under the Plugins area in the sidebar, click Editor. There's a dropdown menu labeled "Select plugin to edit". Click that and select "MailChimp" and then click the "Select" button. The sidebar widget form is called mailchimp/mailchimp_widget.php
The form's code begins right after the first PHP block.
You can also edit the code directly by looking in the wordpress/wp-content/plugins/mailchimp/ directory. The translations are in the po sub-directory.
The trick with this template is that the fields are loaded from elsewhere. In order to change the label, you have to set the option of the fields in the PHP code. Each field is looped through and printed out automatically.
For example to change the "Email Address" label to read "Email" add the following code at the end of the first PHP block:
$mv[0]['name'] = 'Email';
This assumes that the first field that will be printed out is the Email Address field. You can do a var_dump to see what other options are available.
If you want to make more drastic changes to the form, remember that when the widget is updated, you'll have to make the changes again and merge them with the updated version.