Skip to content

Commit 4577bd3

Browse files
committed
[smarcet] - #11412
* addded parametrization for Hero Image, GetStartedURL and AlreadyRegisteredURL
1 parent 70114ae commit 4577bd3

File tree

4 files changed

+42
-12
lines changed

4 files changed

+42
-12
lines changed

coa/_config.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,3 @@
1111
* See the License for the specific language governing permissions and
1212
* limitations under the License.
1313
**/
14-
15-
define('GET_STARTED_URL', 'https://identity.linuxfoundation.org/openstack/pid/317');
16-
define('ALREADY_REGISTERED_URL', 'https://identity.linuxfoundation.org/portal/openstack');

coa/code/ui/COALandingPage.php

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@
1919
class COALandingPage extends Page
2020
{
2121
static $db = array(
22-
'BannerText' => 'HTMLText',
23-
'ExamDetails' => 'HTMLText',
24-
'HandBookLink' => 'Text',
22+
'BannerText' => 'HTMLText',
23+
'ExamDetails' => 'HTMLText',
24+
'HandBookLink' => 'Text',
25+
'GetStartedURL' => 'Text',
26+
'AlreadyRegisteredURL' => 'Text',
2527
);
2628

2729
static $has_one = array
2830
(
29-
31+
'HeroImage' => 'BetterImage',
3032
);
3133

3234
static $many_many = array
@@ -51,7 +53,6 @@ public function getBannerText(){
5153
return $html;
5254
}
5355

54-
5556
public function getExamDetails(){
5657
$html = $this->getField('ExamDetails');
5758
if(empty($html)){
@@ -72,6 +73,30 @@ public function getHandBookLink(){
7273
return $html;
7374
}
7475

76+
public function getGetStartedURL(){
77+
$html = $this->getField('GetStartedURL');
78+
if(empty($html)){
79+
$html = "https://identity.linuxfoundation.org/openstack/pid/317";
80+
}
81+
return $html;
82+
}
83+
84+
public function getAlreadyRegisteredURL(){
85+
$html = $this->getField('AlreadyRegisteredURL');
86+
if(empty($html)){
87+
$html = 'https://identity.linuxfoundation.org/portal/openstack';
88+
}
89+
return $html;
90+
}
91+
92+
public function getHeroImageUrl(){
93+
$default_url = '/themes/openstack/images/coa/coa-bkgd2.jpg';
94+
if($this->HeroImage()->exists()){
95+
return $this->HeroImage()->Link();
96+
}
97+
return $default_url;
98+
}
99+
75100
function getCMSFields()
76101
{
77102
$fields = parent::getCMSFields();
@@ -80,9 +105,18 @@ function getCMSFields()
80105
$fields->addFieldToTab('Root.Main', new HtmlEditorField('BannerText', 'Banner Text'));
81106
$fields->addFieldToTab('Root.Main', new HtmlEditorField('ExamDetails', 'Exam Details'));
82107
$fields->addFieldToTab('Root.Main', new TextField('HandBookLink', 'HandBook Link'));
108+
$fields->addFieldToTab('Root.Main', new TextField('GetStartedURL', 'Get Started URL'));
109+
$fields->addFieldToTab('Root.Main', new TextField('AlreadyRegisteredURL', 'Already Registered URL'));
83110

84111
if ($this->ID > 0) {
85112

113+
$logo_field = new UploadField('HeroImage', 'Hero Image');
114+
$logo_field->setAllowedMaxFileNumber(1);
115+
$logo_field->setAllowedFileCategories('image');
116+
$logo_field->setFolderName('coa/hero_images/');
117+
$logo_field->getValidator()->setAllowedMaxFileSize(1048576);
118+
$fields->addFieldToTab('Root.Main', $logo_field);
119+
86120
$config = GridFieldConfig_RelationEditor::create();
87121

88122
$config->removeComponentsByType('GridFieldEditButton');
@@ -135,14 +169,14 @@ public function index(){
135169

136170
public function getStarted(){
137171
if(Member::currentUser()){
138-
$this->redirect(GET_STARTED_URL);
172+
$this->redirect($this->GetStartedURL);
139173
}
140174
OpenStackIdCommon::doLogin($this->Link('get-started'));
141175
}
142176

143177
public function alreadyRegistered(){
144178
if(Member::currentUser()){
145-
$this->redirect(ALREADY_REGISTERED_URL);
179+
$this->redirect($this->AlreadyRegisteredURL);
146180
}
147181
OpenStackIdCommon::doLogin($this->Link('already-registered'));
148182
}

coa/css/coa.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
/*COA landing*/
33
.coa-hero {
4-
background: url("/themes/openstack/images/coa/coa-bkgd2.jpg") no-repeat center left;
54
background-size: cover;
65
padding: 60px 0 60px;
76
color: white; }

coa/templates/Layout/COALandingPage.ss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- Begin Page Content -->
2-
<div class="coa-hero">
2+
<div class="coa-hero" style="background: url('{$Top.HeroImageUrl}') no-repeat center left;">
33
<div class="container">
44
<div class="row">
55
<div class="col-sm-4 center">

0 commit comments

Comments
 (0)