ninjapanther / sm

0 stars 0 forks source link

Working with Styles in Rails #7

Open ldco2016 opened 7 years ago

ldco2016 commented 7 years ago

Our application is coming along nicely, however, our site is still pretty ugly because we have not implemented any styles. So I am going to start working on the CSS and leveraging custom styles while still using the Bootstrap styles, taking them extending them and customize the way that our site looks, feels and behaves to users.

Here are my following tasks:

ldco2016 commented 7 years ago

Next step for me is to implement a footer along with adding method arguments to a Rails View Helper.

ldco2016 commented 7 years ago

I have Implemented Styles for the Devise Registration Page with Bootstrap 4. Next step is to design the password and login pages forms.

ldco2016 commented 7 years ago

I am going to focus on how to fix a little bug. If you click on products, you are going to see an error. It says wrong number of arguments for our login_helper.

wrong number of arguments (given 0, expected 1)

Our login_helper by default before had no arguments, but I added the ability to add styles but that is creating a problem because in other spots where we are calling login_helper throughout the app such as other layouts we are not passing an argument.

With Ruby we can pass in default values like so:

module ApplicationHelper
  def login_helper style = ''
    if current_user.is_a?(GuestUser)
        (link_to "Register", new_user_registration_path, class: style) +
        " ".html_safe +
        (link_to "Login", new_user_session_path, class: style)
    else
      link_to "Logout", destroy_user_session_path, method: :delete, class: style
    end
  end

  def source_helper(layout_name)
    if session[:source]
      greeting = "Thanks for visiting me from #{session[:source]} and you are on the #{layout_name} layout"
      content_tag(:p, greeting, class: "source-greeting")
    end
  end

  def copyright_generator
     MicrourbViewTool::Renderer.copyright 'Oceancode', 'All rights reserved'
  end
end

What this is saying is that by default style is going to be set, but its just going to be an empty string. Bug resolved.

ldco2016 commented 7 years ago

Now that I have finished the homepage and all the Devise login and registration pages design and ready to go. Now I am going to be looking at designing products.

ldco2016 commented 7 years ago

Now that I finished adding Bootstrap 4 template to the Products page, I am going to use Bootstrap 4 to add a Custom Navbar to the Products Layout in Rails

jwaiswa7 commented 7 years ago

Hi @ldco2016 , How far with the products page?

Should I pull and help you with it..

ldco2016 commented 7 years ago

Yes, I can definitely use the help. I added various "products" and its displaying as a list one beneath the other, as opposed to how it should look on the original Bootstrap album template. Also, the footer is not displaying beneath it all, but to the right as if it was a sidebar. You will find everything nice and organized with partials, but I just think I eliminated some Bootstrap classes I should not have eliminated.

ldco2016 commented 7 years ago

Okay, so I got the footer to appear below. As suspected, I was missing some Bootstrap classes such as container and row, but the "cards" are still appearing in a list format as opposed to how it looks on the original album template.

ldco2016 commented 7 years ago

I don't know if you guys tested out the nav, but if we make changes to a particular nav link, we would have to go and make changes to three different spots thats not a good coding practice as its considered a poor practice in a real life application. I am going to fix that. Additionally, we have nearly identical code in each in application_nav, products_nav and nav. This goes against the principles of DRY (Don't Repeat Yourself). I am going to drill this down to a single line of code utlizing a View Helper. This is an opportunity to implement a shared helper.

jwaiswa7 commented 7 years ago

Meanwhile, the products page nav, should it stay as it is?

We need to complete this project today. The deadline is today, right..

Lets put up issues that have to be resolved, and clean it up.

Kind regards

Joshua Waiswa +256-771-806549 +256-755-924191 skype: waiswa.joshua

Be Yourself, Everyone Else is Already Taken ~ Mike Robbins

On Fri, Sep 15, 2017 at 2:57 AM, Daniel Cortes notifications@github.com wrote:

I don't know if you guys tested out the nav, but if we make changes to a particular nav link, we would have to go and make changes to three different spots thats not a good coding practice as its considered a poor practice in a real life application. I am going to fix that

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ninjapanther/sm/issues/7#issuecomment-329640063, or mute the thread https://github.com/notifications/unsubscribe-auth/AF9SF5Jpkcy2hs1NQrjvoHLEZXXk3_7_ks5sib1RgaJpZM4PR-Jv .

ninjapanther commented 7 years ago

let it remain as it is..due to lack of time

On Fri, Sep 15, 2017 at 12:39 PM, Dominion notifications@github.com wrote:

Meanwhile, the products page nav, should it stay as it is?

We need to complete this project today. The deadline is today, right..

Lets put up issues that have to be resolved, and clean it up.

Kind regards

Joshua Waiswa +256-771-806549 +256-755-924191 skype: waiswa.joshua

Be Yourself, Everyone Else is Already Taken ~ Mike Robbins

On Fri, Sep 15, 2017 at 2:57 AM, Daniel Cortes notifications@github.com wrote:

I don't know if you guys tested out the nav, but if we make changes to a particular nav link, we would have to go and make changes to three different spots thats not a good coding practice as its considered a poor practice in a real life application. I am going to fix that

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ninjapanther/sm/issues/7#issuecomment-329640063, or mute the thread https://github.com/notifications/unsubscribe-auth/ AF9SF5Jpkcy2hs1NQrjvoHLEZXXk3_7_ks5sib1RgaJpZM4PR-Jv .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ninjapanther/sm/issues/7#issuecomment-329700968, or mute the thread https://github.com/notifications/unsubscribe-auth/ANI03lW7NkXMvFD3CEA38G3m8j-FLoCQks5siiK3gaJpZM4PR-Jv .

-- manjusha skype: linuxmary

ninjapanther commented 7 years ago

If you guys have the time to work on it then do it...

jwaiswa7 commented 7 years ago

This needs some work, Am going to do small changes.. here and there.. see if they help..

ldco2016 commented 7 years ago

Joshua, feel free to close this thread out when you are done.

jwaiswa7 commented 7 years ago

Okay, thanks..

Kind regards

Joshua Waiswa +256-771-806549 +256-755-924191 skype: waiswa.joshua

Be Yourself, Everyone Else is Already Taken ~ Mike Robbins

On Fri, Sep 15, 2017 at 5:31 PM, Daniel Cortes notifications@github.com wrote:

Joshua, feel free to close this thread out when you are done.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ninjapanther/sm/issues/7#issuecomment-329799673, or mute the thread https://github.com/notifications/unsubscribe-auth/AF9SF376I0PdCEmw19zLZLDOFA6lPQ0Kks5siopXgaJpZM4PR-Jv .