Jump to content
Sign in to follow this  
Ant

Schema for Work Experience

Recommended Posts

Here is my schema for work experience(Joomla). It might be useful if you have a resume/cv component to your listings.

 

It presents as a single button on the page.

 

post-26704-0-10430600-1482104814_thumb.jpg

 

Which when clicked, reveals the following

 

post-26704-0-93441200-1482104875_thumb.jpg

 

There are a few things I don't like about it, maybe someone can give me some hints on how to change it, but I will explain them later down the page.

 

I've put my schema in a file called work_experience.json located in /components/com_jreviews/jreviews/views/themes/default/fields_formbuilder

 

I've also created a basic work_experience.thtml file in /components/com_jreviews/jreviews/views/themes/default/fields_phpformat Note, I've not done any styling for the data at all. It just dumps the raw info to the listing.

 

I've also 2 additional files months.json and dates.json that go in /components/com_jreviews/jreviews/views/themes/default/fields_formbuilder/definitions

 

I will attach the aforementioned files to this post in workexperience.zip

 

****************************************************************************

The problem I have with this schema is that once you click on the work experience button, all the content is revealed except the task input field (You can see this in workexperience2.jpg). You have to click the task button to have that revealed. I want the input field for task to be revealed along with all the other inputs. workexperience3.jpg shows what I would like to see.

 

post-26704-0-60723800-1482106417_thumb.jpg

 

I have a solution for that, I can add the following code to the schema

,
  "default": {
    "Duties": [
      {
        "task": ""
      }
    ]
  

It successfully shows the task input field. Unfortunately, it creates a problem, when the page is first loaded, instead of seeing a work experience button that you would click to reveal the inputs, all the inputs are already revealed! You don't need to press the button!  When the page is first loaded, I just want to see the work experience button and then when I click the button I'd like the inputs to be revealed (including the task input). This isn't a big problem, I can settle to use this as it is, but if anyone has any suggestions on how to do it the way I'd like to, I'd love to hear from them.

**************************************************

When building this schema, I found the information at https://github.com/jdorn/json-editor to be invaluable (scroll down the linked page for info).

For those of you who would like to play with this immediately just paste the following code into the schema section of https://docs.jreviews.com/playground/formbuilder/

{
	"title": "Resume",
	"type": "array",
	"items": {
		"title": "WORK EXPERIENCE",
		"properties": {
			"details": {
				"title": "Details",
				"type": "object",
				"format": "grid",
				"properties": {
					"position": {
						"title": "Position",
						"type": "string",
						"options": {
							"input_width": "100%",
							"grid_columns": 11
						}
					},
					"monthstart": {
						"title": "Start Month",
						"$ref": "#\/definitions\/months",
						"type": "string"
					},
					"yearstart": {
						"title": "Start Year",
						"$ref": "#\/definitions\/years",
						"type": "string"
					},
					"monthend": {
						"title": "End Month",
						"$ref": "#\/definitions\/months",
						"type": "string"
					},
					"yearend": {
						"title": "End Year",
						"$ref": "#\/definitions\/years",
						"type": "string"
					},
					"companyname": {
						"title": "Company",
						"type": "string",
						"options": {
							"input_width": "100%",
							"grid_columns": 11
						}
					},
					"location": {
						"title": "Location",
						"type": "string",
						"options": {
							"input_width": "100%",
							"grid_columns": 11
						}
					},
					"information": {
						"title": "Information",
						"type": "string",
						"format": "textarea",
						"options": {
							"input_width": "100%",
							"grid_columns": 11
						}
					}
				}
			},
			"Duties": {
				"title": "Tasks/Responsibilities",
				"type": "array",
				"format": "table",
				"items": {
					"title": "Task",
					"type": "object",
					"format": "grid",
					"properties": {
						"task": {
							"title": "Task",
							"type": "string"
						}
					}
				}
			}
		}
	},
	"definitions": {
		"months": {
			"type": "string",
			"enumSource": [{
					"source": [{
							"value": "JAN",
							"title": "January"
						}, {
							"value": "FEB",
							"title": "February"
						}, {
							"value": "MAR",
							"title": "March"
						}, {
							"value": "APR",
							"title": "April"
						}, {
							"value": "MAY",
							"title": "May"
						}, {
							"value": "JUN",
							"title": "June"
						}, {
							"value": "JUL",
							"title": "July"
						}, {
							"value": "AUG",
							"title": "August"
						}, {
							"value": "SEP",
							"title": "September"
						}, {
							"value": "OCT",
							"title": "October"
						}, {
							"value": "NOV",
							"title": "November"
						}, {
							"value": "DEC",
							"title": "December"
						}
					],
					"title": "{{item.title}}",
					"value": "{{item.value}}"
				}
			]
		},
		"years": {
			"type": "string",
			"enumSource": [{
					"source": [{
							"value": "PRESENT",
							"title": "PRESENT"
						}, {
							"value": "1902",
							"title": "1902"
						}, {
							"value": "1903",
							"title": "1903"
						}, {
							"value": "1904",
							"title": "1904"
						}, {
							"value": "1905",
							"title": "1905"
						}, {
							"value": "1906",
							"title": "1906"
						}, {
							"value": "1907",
							"title": "1907"
						}, {
							"value": "1908",
							"title": "1908"
						}, {
							"value": "1909",
							"title": "1909"
						}, {
							"value": "1910",
							"title": "1910"
						}, {
							"value": "1911",
							"title": "1911"
						}, {
							"value": "1912",
							"title": "1912"
						}, {
							"value": "1913",
							"title": "1913"
						}, {
							"value": "1914",
							"title": "1914"
						}, {
							"value": "1915",
							"title": "1915"
						}, {
							"value": "1916",
							"title": "1916"
						}, {
							"value": "1917",
							"title": "1917"
						}, {
							"value": "1918",
							"title": "1918"
						}, {
							"value": "1919",
							"title": "1919"
						}, {
							"value": "1920",
							"title": "1920"
						}, {
							"value": "1921",
							"title": "1921"
						}, {
							"value": "1922",
							"title": "1922"
						}, {
							"value": "1923",
							"title": "1923"
						}, {
							"value": "1924",
							"title": "1924"
						}, {
							"value": "1925",
							"title": "1925"
						}, {
							"value": "1926",
							"title": "1926"
						}, {
							"value": "1927",
							"title": "1927"
						}, {
							"value": "1928",
							"title": "1928"
						}, {
							"value": "1929",
							"title": "1929"
						}, {
							"value": "1930",
							"title": "1930"
						}, {
							"value": "1931",
							"title": "1931"
						}, {
							"value": "1932",
							"title": "1932"
						}, {
							"value": "1933",
							"title": "1933"
						}, {
							"value": "1934",
							"title": "1934"
						}, {
							"value": "1935",
							"title": "1935"
						}, {
							"value": "1936",
							"title": "1936"
						}, {
							"value": "1937",
							"title": "1937"
						}, {
							"value": "1938",
							"title": "1938"
						}, {
							"value": "1939",
							"title": "1939"
						}, {
							"value": "1940",
							"title": "1940"
						}, {
							"value": "1941",
							"title": "1941"
						}, {
							"value": "1942",
							"title": "1942"
						}, {
							"value": "1943",
							"title": "1943"
						}, {
							"value": "1944",
							"title": "1944"
						}, {
							"value": "1945",
							"title": "1945"
						}, {
							"value": "1946",
							"title": "1946"
						}, {
							"value": "1947",
							"title": "1947"
						}, {
							"value": "1948",
							"title": "1948"
						}, {
							"value": "1949",
							"title": "1949"
						}, {
							"value": "1950",
							"title": "1950"
						}, {
							"value": "1951",
							"title": "1951"
						}, {
							"value": "1952",
							"title": "1952"
						}, {
							"value": "1953",
							"title": "1953"
						}, {
							"value": "1954",
							"title": "1954"
						}, {
							"value": "1955",
							"title": "1955"
						}, {
							"value": "1956",
							"title": "1956"
						}, {
							"value": "1957",
							"title": "1957"
						}, {
							"value": "1958",
							"title": "1958"
						}, {
							"value": "1959",
							"title": "1959"
						}, {
							"value": "1960",
							"title": "1960"
						}, {
							"value": "1961",
							"title": "1961"
						}, {
							"value": "1962",
							"title": "1962"
						}, {
							"value": "1963",
							"title": "1963"
						}, {
							"value": "1964",
							"title": "1964"
						}, {
							"value": "1965",
							"title": "1965"
						}, {
							"value": "1966",
							"title": "1966"
						}, {
							"value": "1967",
							"title": "1967"
						}, {
							"value": "1968",
							"title": "1968"
						}, {
							"value": "1969",
							"title": "1969"
						}, {
							"value": "1970",
							"title": "1970"
						}, {
							"value": "1971",
							"title": "1971"
						}, {
							"value": "1972",
							"title": "1972"
						}, {
							"value": "1973",
							"title": "1973"
						}, {
							"value": "1974",
							"title": "1974"
						}, {
							"value": "1975",
							"title": "1975"
						}, {
							"value": "1976",
							"title": "1976"
						}, {
							"value": "1977",
							"title": "1977"
						}, {
							"value": "1978",
							"title": "1978"
						}, {
							"value": "1979",
							"title": "1979"
						}, {
							"value": "1980",
							"title": "1980"
						}, {
							"value": "1981",
							"title": "1981"
						}, {
							"value": "1982",
							"title": "1982"
						}, {
							"value": "1983",
							"title": "1983"
						}, {
							"value": "1984",
							"title": "1984"
						}, {
							"value": "1985",
							"title": "1985"
						}, {
							"value": "1986",
							"title": "1986"
						}, {
							"value": "1987",
							"title": "1987"
						}, {
							"value": "1988",
							"title": "1988"
						}, {
							"value": "1989",
							"title": "1989"
						}, {
							"value": "1990",
							"title": "1990"
						}, {
							"value": "1991",
							"title": "1991"
						}, {
							"value": "1992",
							"title": "1992"
						}, {
							"value": "1993",
							"title": "1993"
						}, {
							"value": "1994",
							"title": "1994"
						}, {
							"value": "1995",
							"title": "1995"
						}, {
							"value": "1996",
							"title": "1996"
						}, {
							"value": "1997",
							"title": "1997"
						}, {
							"value": "1998",
							"title": "1998"
						}, {
							"value": "1999",
							"title": "1999"
						}, {
							"value": "2000",
							"title": "2000"
						}, {
							"value": "2001",
							"title": "2001"
						}, {
							"value": "2002",
							"title": "2002"
						}, {
							"value": "2003",
							"title": "2003"
						}, {
							"value": "2004",
							"title": "2004"
						}, {
							"value": "2005",
							"title": "2005"
						}, {
							"value": "2006",
							"title": "2006"
						}, {
							"value": "2007",
							"title": "2007"
						}, {
							"value": "2008",
							"title": "2008"
						}, {
							"value": "2009",
							"title": "2009"
						}, {
							"value": "2010",
							"title": "2010"
						}, {
							"value": "2011",
							"title": "2011"
						}, {
							"value": "2012",
							"title": "2012"
						}, {
							"value": "2013",
							"title": "2013"
						}, {
							"value": "2014",
							"title": "2014"
						}, {
							"value": "2015",
							"title": "2015"
						}, {
							"value": "2016",
							"title": "2016"
						}, {
							"value": "2017",
							"title": "2017"
						}, {
							"value": "2018",
							"title": "2018"
						}, {
							"value": "2019",
							"title": "2019"
						}, {
							"value": "2020",
							"title": "2020"
						}, {
							"value": "2021",
							"title": "2021"
						}, {
							"value": "2022",
							"title": "2022"
						}, {
							"value": "2023",
							"title": "2023"
						}, {
							"value": "2024",
							"title": "2024"
						}, {
							"value": "2025",
							"title": "2025"
						}, {
							"value": "2026",
							"title": "2026"
						}, {
							"value": "2027",
							"title": "2027"
						}, {
							"value": "2028",
							"title": "2028"
						}, {
							"value": "2029",
							"title": "2029"
						}, {
							"value": "2030",
							"title": "2030"
						}, {
							"value": "2031",
							"title": "2031"
						}, {
							"value": "2032",
							"title": "2032"
						}, {
							"value": "2033",
							"title": "2033"
						}, {
							"value": "2034",
							"title": "2034"
						}, {
							"value": "2035",
							"title": "2035"
						}, {
							"value": "2036",
							"title": "2036"
						}, {
							"value": "2037",
							"title": "2037"
						}, {
							"value": "2038",
							"title": "2038"
						}, {
							"value": "2039",
							"title": "2039"
						}, {
							"value": "2040",
							"title": "2040"
						}, {
							"value": "2041",
							"title": "2041"
						}, {
							"value": "2042",
							"title": "2042"
						}, {
							"value": "2043",
							"title": "2043"
						}, {
							"value": "2044",
							"title": "2044"
						}, {
							"value": "2045",
							"title": "2045"
						}, {
							"value": "2046",
							"title": "2046"
						}, {
							"value": "2047",
							"title": "2047"
						}, {
							"value": "2048",
							"title": "2048"
						}, {
							"value": "2049",
							"title": "2049"
						}, {
							"value": "2050",
							"title": "2050"
						}, {
							"value": "2051",
							"title": "2051"
						}, {
							"value": "2052",
							"title": "2052"
						}, {
							"value": "2053",
							"title": "2053"
						}, {
							"value": "2054",
							"title": "2054"
						}, {
							"value": "2055",
							"title": "2055"
						}, {
							"value": "2056",
							"title": "2056"
						}, {
							"value": "2057",
							"title": "2057"
						}, {
							"value": "2058",
							"title": "2058"
						}, {
							"value": "2059",
							"title": "2059"
						}, {
							"value": "2060",
							"title": "2060"
						}, {
							"value": "2061",
							"title": "2061"
						}, {
							"value": "2062",
							"title": "2062"
						}, {
							"value": "2063",
							"title": "2063"
						}, {
							"value": "2064",
							"title": "2064"
						}, {
							"value": "2065",
							"title": "2065"
						}, {
							"value": "2066",
							"title": "2066"
						}, {
							"value": "2067",
							"title": "2067"
						}, {
							"value": "2068",
							"title": "2068"
						}, {
							"value": "2069",
							"title": "2069"
						}, {
							"value": "2070",
							"title": "2070"
						}, {
							"value": "2071",
							"title": "2071"
						}, {
							"value": "2072",
							"title": "2072"
						}, {
							"value": "2073",
							"title": "2073"
						}, {
							"value": "2074",
							"title": "2074"
						}, {
							"value": "2075",
							"title": "2075"
						}, {
							"value": "2076",
							"title": "2076"
						}, {
							"value": "2077",
							"title": "2077"
						}, {
							"value": "2078",
							"title": "2078"
						}, {
							"value": "2079",
							"title": "2079"
						}, {
							"value": "2080",
							"title": "2080"
						}, {
							"value": "2081",
							"title": "2081"
						}, {
							"value": "2082",
							"title": "2082"
						}, {
							"value": "2083",
							"title": "2083"
						}, {
							"value": "2084",
							"title": "2084"
						}, {
							"value": "2085",
							"title": "2085"
						}, {
							"value": "2086",
							"title": "2086"
						}, {
							"value": "2087",
							"title": "2087"
						}, {
							"value": "2088",
							"title": "2088"
						}, {
							"value": "2089",
							"title": "2089"
						}, {
							"value": "2090",
							"title": "2090"
						}, {
							"value": "2091",
							"title": "2091"
						}, {
							"value": "2092",
							"title": "2092"
						}, {
							"value": "2093",
							"title": "2093"
						}, {
							"value": "2094",
							"title": "2094"
						}, {
							"value": "2095",
							"title": "2095"
						}, {
							"value": "2096",
							"title": "2096"
						}, {
							"value": "2097",
							"title": "2097"
						}, {
							"value": "2098",
							"title": "2098"
						}, {
							"value": "2099",
							"title": "2099"
						}

					],
					"title": "{{item.title}}",
					"value": "{{item.value}}"
				}
			]
		}
	}
}

Lastly, if you just want to paste into the schema section of the administrative section of JReviews, you will need to remove the wrap code from work_experience.json If you just paste work_experience.json in, it won't work. You need to remove the code that is wrapping the schema. In my example below, the code you want to paste starts with // and ends with \\. Remove everything else. Note that there won't actually be a //\\ in the schema code.

{
	"name": "Work Experience Menu",
	"theme": "work_experience",
	"schema": { //KEEP THIS BIT\\ }
}

For convenience, I've included the code without the wrap below, so you can just paste it into the administrative backend's schema section in Fields Manager-> custom field.

{
    "title": "Resume",
    "type": "array",
    "items": {
        "title": "WORK EXPERIENCE",
        "properties": {
            "details": {
                "title": "Details",
                "type": "object",
                "format": "grid",
                "properties": {
                    "position": {
                        "title": "Position",
                        "type": "string",
                        "options": {
                            "input_width": "100%",
                            "grid_columns": 11
                        }
                    },
                    "monthstart": {
                        "title": "Start Month",
                        "$ref": "/components/com_jreviews/jreviews/views/themes/default/fields_formbuilder/definitions/months.json",
                        "type": "string"
                    },
                    "yearstart": {
                        "title": "Start Year",
                        "$ref": "/components/com_jreviews/jreviews/views/themes/default/fields_formbuilder/definitions/dates.json",
                        "type": "string"
                    },
                    "monthend": {
                        "title": "End Month",
                        "$ref": "/components/com_jreviews/jreviews/views/themes/default/fields_formbuilder/definitions/months.json",
                        "type": "string"
                    },
                    "yearend": {
                        "title": "End Year",
                        "$ref": "/components/com_jreviews/jreviews/views/themes/default/fields_formbuilder/definitions/dates.json",
                        "type": "string"
                    },
                    "companyname": {
                        "title": "Company",
                        "type": "string",
                        "options": {
                            "input_width": "100%",
                            "grid_columns": 11
                        }
                    },
                    "location": {
                        "title": "Location",
                        "type": "string",
                        "options": {
                            "input_width": "100%",
                            "grid_columns": 11
                        }
                    },
                    "information": {
                        "title": "Information",
                        "type": "string",
                        "format": "textarea",
                        "options": {
                            "input_width": "100%",
                            "grid_columns": 11
                        }
                    }
                }
            },
            "Duties": {
                "title": "Tasks/Responsibilities",
                "type": "array",
                "format": "table",
                "items": {
                    "title": "Task",
                    "type": "object",
                    "format": "grid",
                    "properties": {
                        "task": {
                            "title": "Task",
                            "type": "string",
                            "options": {
                                "input_width": "90%",
                                "grid_columns": 11
                            }
                        }
                    }
                }
            }
        }
    }
}

workexperience.zip

Edited by Ant

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Please refer to our Privacy Policy.