From 9a5406a049f42e1940e9ab62726400d30b7399fa Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 5 Dec 2017 12:15:48 -0500 Subject: [PATCH 1/4] styles galore --- index.php | 5 ++ www/application/controllers/All_Tweets.php | 6 +- www/application/controllers/Login.php | 14 +++- www/application/controllers/Register.php | 7 +- www/application/controllers/Tweet.php | 29 -------- www/application/controllers/User_Tweets.php | 2 + www/application/views/home.php | 28 +++++--- www/application/views/login.php | 30 ++++---- www/application/views/register.php | 63 +++++++++-------- www/application/views/templates/footer.php | 2 +- www/application/views/templates/header.php | 1 + www/application/views/templates/nav.php | 12 ++++ www/application/views/tweet.php | 9 --- www/application/views/user.php | 15 ++-- www/contributing.md | 4 +- www/css/styles.css | 77 ++++++++++++++++----- 16 files changed, 182 insertions(+), 122 deletions(-) create mode 100644 index.php delete mode 100644 www/application/controllers/Tweet.php create mode 100644 www/application/views/templates/nav.php delete mode 100644 www/application/views/tweet.php diff --git a/index.php b/index.php new file mode 100644 index 0000000..139509d --- /dev/null +++ b/index.php @@ -0,0 +1,5 @@ +format('m/d/y'); ?> diff --git a/www/application/controllers/All_Tweets.php b/www/application/controllers/All_Tweets.php index 4e32d65..6974b1a 100644 --- a/www/application/controllers/All_Tweets.php +++ b/www/application/controllers/All_Tweets.php @@ -14,6 +14,7 @@ public function index() { $this->data['posts'] = $this->All_Tweets_Model->getPosts(); // calling Post model method getPosts() $this->load->view('templates/header', NULL); + $this->load->view('templates/nav', NULL); $this->load->view('home', $this->data); // load the view file , we are passing $data array to view file $this->load->view('templates/footer', NULL); } @@ -22,9 +23,10 @@ function search_keyword(){ $keyword = $this->input->post('keyword'); $data['results'] = $this->All_Tweets_Model->search($keyword); - $this->load->view('templates/header'); + $this->load->view('templates/header', NULL); + $this->load->view('templates/nav', NULL); $this->load->view('home', $data); // load the view file , we are passing $data array to view file - $this->load->view('templates/footer'); + $this->load->view('templates/footer', NULL); } } diff --git a/www/application/controllers/Login.php b/www/application/controllers/Login.php index da638ce..2fb8078 100644 --- a/www/application/controllers/Login.php +++ b/www/application/controllers/Login.php @@ -5,7 +5,7 @@ function __Construct(){ parent::__Construct(); $this->load->database(); // load database $this->load->model('User_Info_Model'); // load model - $this->output->enable_profiler(TRUE); + //$this->output->enable_profiler(TRUE); } public function index(){ @@ -15,8 +15,12 @@ public function index(){ $this->form_validation->set_rules('username', 'Username', 'required'); $this->form_validation->set_rules('password', 'Password', 'required'); - if ($this->form_validation->run() == FALSE) + if ($this->form_validation->run() == FALSE){ + $this->load->view('templates/header'); $this->load->view('login'); + $this->load->view('templates/footer'); + } + // load the homepage if login successful // https://www.codeigniter.com/user_guide/libraries/form_validation.html#callbacks-your-own-validation-methods @@ -30,7 +34,11 @@ public function index(){ redirect('/all_tweets'); } // if no, refresh login - else $this->load->view('login', $data); + else { + $this->load->view('templates/header'); + $this->load->view('login', $data); + $this->load->view('templates/footer'); + } } } diff --git a/www/application/controllers/Register.php b/www/application/controllers/Register.php index f8ff82b..5b6db13 100644 --- a/www/application/controllers/Register.php +++ b/www/application/controllers/Register.php @@ -22,8 +22,11 @@ public function index(){ array('required' => 'You must provide a %s.')); $this->form_validation->set_rules('email', 'Email', 'required|valid_email'); - if ($this->form_validation->run() == FALSE) - $this->load->view('register'); + if ($this->form_validation->run() == FALSE){ + $this->load->view('templates/header'); + $this->load->view('register'); + $this->load->view('templates/footer'); + } // load the homepage once properly submitted // https://www.codeigniter.com/user_guide/libraries/form_validation.html#callbacks-your-own-validation-methods diff --git a/www/application/controllers/Tweet.php b/www/application/controllers/Tweet.php deleted file mode 100644 index 6f8945d..0000000 --- a/www/application/controllers/Tweet.php +++ /dev/null @@ -1,29 +0,0 @@ -load->database(); // load database - $this->load->model('User_Tweets_Model'); // load model - $this->output->enable_profiler(TRUE); - } - - public function index(){ - $this->load->helper('form'); - $this->load->library('form_validation'); - - $data['title'] = 'Create a tweet'; - - $this->form_validation->set_rules('tweet', 'Tweet', 'required'); - - if ($this->form_validation->run() === FALSE) - { - $this->load->view('tweet', $data); - } - else - { - $this->User_Tweets_Model->addTweet(); - $this->load->view('formsuccess'); - } - } -} diff --git a/www/application/controllers/User_Tweets.php b/www/application/controllers/User_Tweets.php index fc5b71c..8f7cedb 100644 --- a/www/application/controllers/User_Tweets.php +++ b/www/application/controllers/User_Tweets.php @@ -14,6 +14,7 @@ function __Construct(){ public function index() { $this->data['posts'] = $this->User_Tweets_Model->getPosts(); // calling Post model method getPosts() $this->load->view('templates/header', NULL); + $this->load->view('templates/nav', NULL); $this->load->view('user', $this->data); // load the view file , we are passing $data array to view file $this->load->view('templates/footer', NULL); } @@ -27,6 +28,7 @@ public function create(){ { $this->data['posts'] = $this->User_Tweets_Model->getPosts(); // calling Post model method getPosts() $this->load->view('templates/header', NULL); + $this->load->view('templates/nav'); $this->load->view('user', $this->data); // load the view file , we are passing $data array to view file $this->load->view('templates/footer', NULL); } diff --git a/www/application/views/home.php b/www/application/views/home.php index e2d71ab..b981a2b 100644 --- a/www/application/views/home.php +++ b/www/application/views/home.php @@ -14,20 +14,27 @@ load->library('form_validation'); ?> - - - + +
+
+ +
+
- " . $row['first_name'] . " " . $row['last_name'] . ""; ?> - " . "@" . $row['username'] . "";?> + " . $row['first_name'] . " " . $row['last_name'] . " " . "" . "@" . $row['username'] . "" . ""; ?> +
- + format('m/d/y h:s A'); + ?>
@@ -42,11 +49,14 @@
- " . $post['first_name'] . " " . $post['last_name'] . ""; ?> - " . "@" . $post['username'] . "";?> + " . $post['first_name'] . " " . $post['last_name'] . " " . "" . "@" . $post['username'] . "" . ""; ?>
- + format('m/d/y h:s A'); + ?>
diff --git a/www/application/views/login.php b/www/application/views/login.php index 28ddfa7..9bc3fc2 100644 --- a/www/application/views/login.php +++ b/www/application/views/login.php @@ -2,20 +2,20 @@ $this->load->library('form_validation'); echo validation_errors(); echo form_open('login'); ?> - + diff --git a/www/application/views/register.php b/www/application/views/register.php index e375ec1..53b8ce5 100644 --- a/www/application/views/register.php +++ b/www/application/views/register.php @@ -2,32 +2,39 @@ $this->load->library('form_validation'); echo validation_errors(); echo form_open('register'); ?> -

Register

-
First Name
- - - -
Last Name
- - - -
Email Address
- - - -
Location
- - - -
Username
- - - -
Password
- - - -

-
- + diff --git a/www/application/views/templates/footer.php b/www/application/views/templates/footer.php index ada7589..4d7767a 100644 --- a/www/application/views/templates/footer.php +++ b/www/application/views/templates/footer.php @@ -1,4 +1,4 @@ - © 2017 Singh and Stumper Studios + © 2017 Stingh Design diff --git a/www/application/views/templates/header.php b/www/application/views/templates/header.php index 9b498e7..ae38645 100644 --- a/www/application/views/templates/header.php +++ b/www/application/views/templates/header.php @@ -7,4 +7,5 @@ + diff --git a/www/application/views/templates/nav.php b/www/application/views/templates/nav.php new file mode 100644 index 0000000..4c9ec14 --- /dev/null +++ b/www/application/views/templates/nav.php @@ -0,0 +1,12 @@ + diff --git a/www/application/views/tweet.php b/www/application/views/tweet.php deleted file mode 100644 index 1d67d47..0000000 --- a/www/application/views/tweet.php +++ /dev/null @@ -1,9 +0,0 @@ -load->library('form_validation'); ?> - - -
Tweet
- - - -
- diff --git a/www/application/views/user.php b/www/application/views/user.php index b23ef2d..dd61f01 100644 --- a/www/application/views/user.php +++ b/www/application/views/user.php @@ -5,10 +5,12 @@ load->library('form_validation'); ?> - +
+ +
+ -
@@ -16,11 +18,14 @@
- " . $post['first_name'] . " " . $post['last_name'] . ""; ?> - " . "@" . $post['username'] . "";?> + " . $post['first_name'] . " " . $post['last_name'] . " " . "" . "@" . $post['username'] . "" . ""; ?>
- + format('m/d/y h:s A'); + ?>
diff --git a/www/contributing.md b/www/contributing.md index 2037e04..509cf97 100755 --- a/www/contributing.md +++ b/www/contributing.md @@ -72,7 +72,7 @@ Hard way The best way to contribute is to "clone" your fork of CodeIgniter to yo 2. Go to the CodeIgniter repo 3. Fork it 4. Clone your CodeIgniter repo: git@github.com:/CodeIgniter.git -5. Checkout the "develop" branch At this point you are ready to start making changes. +5. Checkout the "develop" branch At this point you are ready to start making changes. 6. Fix existing bugs on the Issue tracker after taking a look to see nobody else is working on them. 7. Commit the files 8. Push your develop branch to your fork @@ -92,4 +92,4 @@ If you are using command-line you can do the following: 2. `git pull codeigniter develop` 3. `git push origin develop` -Now your fork is up to date. This should be done regularly, or before you send a pull request at least. \ No newline at end of file +Now your fork is up to date. This should be done regularly, or before you send a pull request at least. diff --git a/www/css/styles.css b/www/css/styles.css index bb75e82..83fe8f1 100644 --- a/www/css/styles.css +++ b/www/css/styles.css @@ -1,24 +1,67 @@ +body { + background-color: #E3F3FD; +} + +img.home-icon { + width: 50px; + margin-top: -.85em; + margin-left: 4em; +} + +.login { + max-width:45%; + margin:0 auto; + margin-top: 100px; +} + +.register { + margin-top: 25px; +} + +.icon { + width: 45%; + margin-left: 30%; +} + +img.icon.reg { + width: 25%; + margin-left: 38%; +} + .home{ max-width:60%; - margin:0 auto + margin:0 auto; +} + +.tweet-container{ + border:1px solid #eeeeee; + margin-bottom:15px; + margin-top: 15px; + max-width:100%; + background-color: white; + border-radius: 25px; + padding: 20px; +} + +.tweet-container h3{ + margin-top:0!important } - .tweet-container{ - border:1px solid #eeeeee; - padding:15px; - margin-bottom:15px; - max-width:100%; - } +.handle { + color: grey; +} - .tweet-container h3{ - margin-top:0!important - } +.date{ + color:grey; + float: right; +} - .date{ - color:grey - } +.tweet{ + font-size: 16px; + font-style: italic; +} - .tweet{ - font-size: 16px; - font-style: italic; - } +.footer { + margin-bottom: 5px; + margin-left: 5px; +} From 53fec36262ae9de060e0e58735119cbdb62382d5 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 5 Dec 2017 14:29:01 -0500 Subject: [PATCH 2/4] styles and bugs squashed --- www/application/controllers/All_Tweets.php | 2 +- www/application/controllers/Login.php | 3 +-- www/application/controllers/Register.php | 3 +-- www/application/controllers/User_Tweets.php | 3 ++- www/application/models/User_Tweets_Model.php | 4 +--- www/application/views/home.php | 24 +++++++++++++------- www/application/views/login.php | 7 +++++- www/application/views/register.php | 5 ++++ www/application/views/templates/header.php | 1 + www/application/views/templates/nav.php | 6 ++--- www/application/views/user.php | 9 ++++++-- www/css/styles.css | 1 + 12 files changed, 45 insertions(+), 23 deletions(-) diff --git a/www/application/controllers/All_Tweets.php b/www/application/controllers/All_Tweets.php index 6974b1a..df80855 100644 --- a/www/application/controllers/All_Tweets.php +++ b/www/application/controllers/All_Tweets.php @@ -7,7 +7,7 @@ function __Construct(){ parent::__Construct (); $this->load->database(); // load database $this->load->model('All_Tweets_Model'); // load model - $this->output->enable_profiler(TRUE); + //$this->output->enable_profiler(TRUE); } public function index() { diff --git a/www/application/controllers/Login.php b/www/application/controllers/Login.php index 2fb8078..3a5fee6 100644 --- a/www/application/controllers/Login.php +++ b/www/application/controllers/Login.php @@ -11,6 +11,7 @@ function __Construct(){ public function index(){ $this->load->helper(array('form', 'url')); $this->load->library('form_validation'); + $this->form_validation->set_error_delimiters('', ''); $this->form_validation->set_rules('username', 'Username', 'required'); $this->form_validation->set_rules('password', 'Password', 'required'); @@ -18,7 +19,6 @@ public function index(){ if ($this->form_validation->run() == FALSE){ $this->load->view('templates/header'); $this->load->view('login'); - $this->load->view('templates/footer'); } @@ -37,7 +37,6 @@ public function index(){ else { $this->load->view('templates/header'); $this->load->view('login', $data); - $this->load->view('templates/footer'); } } diff --git a/www/application/controllers/Register.php b/www/application/controllers/Register.php index 5b6db13..603ce97 100644 --- a/www/application/controllers/Register.php +++ b/www/application/controllers/Register.php @@ -5,7 +5,7 @@ function __Construct(){ parent::__Construct(); $this->load->database(); // load database $this->load->model('User_Info_Model'); // load model - $this->output->enable_profiler(TRUE); + //$this->output->enable_profiler(TRUE); } public function index(){ @@ -25,7 +25,6 @@ public function index(){ if ($this->form_validation->run() == FALSE){ $this->load->view('templates/header'); $this->load->view('register'); - $this->load->view('templates/footer'); } // load the homepage once properly submitted diff --git a/www/application/controllers/User_Tweets.php b/www/application/controllers/User_Tweets.php index 8f7cedb..758e1f3 100644 --- a/www/application/controllers/User_Tweets.php +++ b/www/application/controllers/User_Tweets.php @@ -8,10 +8,11 @@ function __Construct(){ //$this->load->library('session'); $this->load->database(); // load database $this->load->model('User_Tweets_Model'); // load model - $this->output->enable_profiler(TRUE); + //$this->output->enable_profiler(TRUE); } public function index() { + // get posts based on user ID $this->data['posts'] = $this->User_Tweets_Model->getPosts(); // calling Post model method getPosts() $this->load->view('templates/header', NULL); $this->load->view('templates/nav', NULL); diff --git a/www/application/models/User_Tweets_Model.php b/www/application/models/User_Tweets_Model.php index 7e066d2..71b9b06 100644 --- a/www/application/models/User_Tweets_Model.php +++ b/www/application/models/User_Tweets_Model.php @@ -1,11 +1,9 @@ db->select("first_name, last_name, username, tweet, date_time"); $this->db->from('Users, Tweets'); - $this->db->where("Users.id = Tweets.user_id and Users.id = $user_id"); + $this->db->where("Users.id = Tweets.user_id"); $this->db->order_by('date_time', 'DESC'); $query = $this->db->get(); return $query->result_array(); diff --git a/www/application/views/home.php b/www/application/views/home.php index b981a2b..e3eafcf 100644 --- a/www/application/views/home.php +++ b/www/application/views/home.php @@ -31,10 +31,14 @@
format('m/d/y h:s A'); - ?> + $startDate = $row['date_time']; + $start = new DateTime($startDate); + $timestring = $start->format('m/d/y h:s A'); + $time_arr = str_split($timestring); + if($time_arr[count($time_arr) - 8] === '0') + unset($time_arr[count($time_arr) - 8]); + echo implode("",$time_arr); + ?>
@@ -53,10 +57,14 @@
format('m/d/y h:s A'); - ?> + $startDate = $post['date_time']; + $start = new DateTime($startDate); + $timestring = $start->format('m/d/y h:s A'); + $time_arr = str_split($timestring); + if($time_arr[count($time_arr) - 8] === '0') + unset($time_arr[count($time_arr) - 8]); + echo implode("",$time_arr); + ?>
diff --git a/www/application/views/login.php b/www/application/views/login.php index 9bc3fc2..a7fb579 100644 --- a/www/application/views/login.php +++ b/www/application/views/login.php @@ -1,7 +1,8 @@ load->library('form_validation'); echo validation_errors(); - echo form_open('login'); ?> + echo form_open('login'); + ?> + + + + + diff --git a/www/application/views/templates/header.php b/www/application/views/templates/header.php index ae38645..63a8bb1 100644 --- a/www/application/views/templates/header.php +++ b/www/application/views/templates/header.php @@ -6,6 +6,7 @@ + diff --git a/www/application/views/templates/nav.php b/www/application/views/templates/nav.php index 4c9ec14..ae34f99 100644 --- a/www/application/views/templates/nav.php +++ b/www/application/views/templates/nav.php @@ -1,12 +1,12 @@ diff --git a/www/application/views/user.php b/www/application/views/user.php index dd61f01..b61a197 100644 --- a/www/application/views/user.php +++ b/www/application/views/user.php @@ -6,7 +6,8 @@
- + +
@@ -24,7 +25,11 @@ format('m/d/y h:s A'); + $timestring = $start->format('m/d/y h:s A'); + $time_arr = str_split($timestring); + if($time_arr[count($time_arr) - 8] === '0') + unset($time_arr[count($time_arr) - 8]); + echo implode("",$time_arr); ?>
diff --git a/www/css/styles.css b/www/css/styles.css index 83fe8f1..6670c45 100644 --- a/www/css/styles.css +++ b/www/css/styles.css @@ -1,5 +1,6 @@ body { background-color: #E3F3FD; + font-family: 'Source Sans Pro', sans-serif; } img.home-icon { From 677ed0f569eb606c4372da37c17d193e0517eed0 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 5 Dec 2017 14:57:56 -0500 Subject: [PATCH 3/4] fixed error report location --- www/application/config/config.php | 2 +- www/application/views/home.php | 4 +--- www/application/views/login.php | 3 +-- www/application/views/register.php | 1 - www/application/views/templates/footer.php | 2 ++ www/application/views/user.php | 15 ++++++--------- www/css/styles.css | 3 +-- 7 files changed, 12 insertions(+), 18 deletions(-) diff --git a/www/application/config/config.php b/www/application/config/config.php index 24bf583..06b5638 100755 --- a/www/application/config/config.php +++ b/www/application/config/config.php @@ -23,7 +23,7 @@ | a PHP script and you can easily do that on your own. | */ -$config['base_url'] = 'http://twitter-clone.lndo.site/'; +$config['base_url'] = 'http://' . $_SERVER['HTTP_HOST'] . '/'; /* |-------------------------------------------------------------------------- diff --git a/www/application/views/home.php b/www/application/views/home.php index e3eafcf..6fef44d 100644 --- a/www/application/views/home.php +++ b/www/application/views/home.php @@ -13,9 +13,7 @@

All Tweets

load->library('form_validation'); ?> - - -
+
diff --git a/www/application/views/login.php b/www/application/views/login.php index a7fb579..da6ddee 100644 --- a/www/application/views/login.php +++ b/www/application/views/login.php @@ -1,6 +1,5 @@ load->library('form_validation'); - echo validation_errors(); echo form_open('login'); ?> - or Create an account + or Create an account
diff --git a/www/application/views/register.php b/www/application/views/register.php index 3045c72..47a10f7 100644 --- a/www/application/views/register.php +++ b/www/application/views/register.php @@ -1,6 +1,5 @@ load->library('form_validation'); - echo validation_errors(); echo form_open('register'); ?>