Show featured item in view - ruby-on-rails

This is more of a generalized approach question. I wanted to see if anyone could give me some pointers.
I'm making a rails app that will have a "featured item". This item will have a start date/time and an end date/time, and only one item will be within that time range (so, if today is within item X's range, item X is the current featured item).
For showing this in my View, would it be best just to show whichever one has a start date that's <= than today's date/time and end date that's >= than today's date/time, or is there a better way to approach it? Each item will have a picture and some text - nothing too fancy.
I'm looking forward to hearing your thoughts.

I would put the featured logic in your model. The time constraints you have sound good. It is good to put the featured logic in your model because you can then make a validation that ensures that no item has a featured time range that overlaps another one. Then in your view you could simply call something like Post.get_featured and that would get the current featured post.

Related

Hyperlink to particular Text in a cell on the same sheet

I'm working with Excel 2010. What I'm trying to accomplish is creating a hyperlink which finds a cell containing some specific text, and simply brings the user to that cell. It would be simple if the cell stayed in the same position in the column, but more data is always being added to that column, and the cell location which contains the text keeps changing.
Although I've seen several articles that I suspect might address the problem, they were so involved that I couldn't be certain they were what I was looking for, since I've been away from this for years, and am relearning it all from scratch.
Thanks for your time and attention.
Say we want to go to "treasure" in column D:
=HYPERLINK("#d" & MATCH("treasure",D:D,0),"jump to treasure")
This can be modified if you did not know which column to search!

Google Sheets - Validation list to default on selection in another cell, but still provide drop-down options

I'm stuck on this one, and after a number of google searches am now wondering if I'm the only person who's ever tried to do this.
I have a google sheet that users are required to fill in. There is a drop-down selection option at the top, specifying the region the user needs the file for.
However, as the user gets down to the lines for the individual items required, some (a small number) may not be for the region selected at the top.
So what I'm trying to do is add the regions to the individual lines. The default for each line should be the region selected at the top, so this should show as pre-selected. But I want the user to be able to still click on a drop-down arrow and select a different region for a line.
Does anyone have any ideas on how to do this? Thank you!
Okay,
I'm unsure of your expected outcome, your request is also not very clear -
What I've done is created a list via Data validation, however, if a user enters data into the adjacent column:
https://docs.google.com/spreadsheets/d/1OsrQCUt-Urf_Gx8_l9CBZkaUlDc311-S-0csa9GAtCQ/edit?usp=sharing
also it's good practice to share an example of your workbook for others to edit and work on.
let me know if this is what you wanted.

How can I create a timetable using tableview?

I am going to create a timetable in xcode, and will put in my lessons etc. at school.
I want to have a static header, as well as a static left column (which will be a lot smaller than the other one). And how do I get this editable, so the user can make it personal?
In more detail:
It will be as a normal timetable. I will have a main menu, which will consist of buttons, and all the days of the week. e.g:
Monday (-----) this will then link to a new view controller where it is a left column (which is pretty tiny). In that left column the time of the lesson will be. In the right column, which is bigger, the lesson and the teacher you're having will be in column. I also want there to be an edit button, so the user of the timetable can put in their lessons and which time they will be.
Same with the other days.
I am following this Tutorial on how to make a horizontal table.
Thank you.

Digital Metaphors ReportBuilder: Page subtotals

I have a report created with Digital Metaphors ReportBuilder (VCL edition, in Delphi XE3).
It's an invoice, with header, detail and footer bands.
When the data fits in one page, all is well.
If I have more data, that fills, lets say for the sake of argument, 2 pages, I would requires:
Footer band only in the last page
On all other pages, the footer band should be replaced with only the running amount from the detail band, up until that page (from the first one).
On all but the first, the header should include the running totals of all previous pages.
Something like:
Page 1:
- (Header)
- Detail
- "Value until now: (Sum of one the the fields present in the detail band)"
Page 2:
- (Header)
- "Value until now: (Sum of one the the fields present in the detail band) of previous pages"
- Detail
- Footer
I've tried to investigate group totals, using a DBCalc component, but those aren't aware of the page. It only shows the total in the end, and not at the end of the page.
Any pointers of how I could do this?
Thank you
You will need to make some use of the Calc tab, in order to decide when you want certain bands to be shown or hidden. The Report has a PageNo property which you can use to decide when to show a header or a footer, in the header or footer's BeforePrint event.
As for showing a running total at the bottom of each page, you could use a ppRegion component (which is the ReportBuilder equivalent of a Panel). Again, you can use the BeforePrint event to decide when this shows.
The running totals themselves should be done using ppVariables. As you traverse through the data, add values into each variable that you need. Put these variables in the Region mentioned above, and they will display the value as it is at the end of each page. Timing can play a part here, so you may need to adjust the Variable's CalcType, ResetType, CalcComponent and ResetComponent properties to fit your needs.
I have been using ReportBuilder for almost 10 years and believe me, everything can be done, but some operations may just take time to perfect. We now use it exclusively in our software, both for the standard reports that we issue with our product (over 300) and for users to create their own reports.

Idiomatic way to edit and delete table row cells

Default behavior of a tableview is to highlight in blue a selected row.
I have an edit/delete (not sure on the wording yet) button that puts the table in edit mode, showing the red delete circles.
I'm unsure about how or even whether to let the user edit the text of a row. (Although until now "whether" hasn't even crossed my mind.)
Is it better to let the user add and delete items, or should I include an edit function?
If I should include an edit function, should it be triggered by the same edit function that makes the delete circles appear, or should editing be enabled by another button (limited space for buttons) or even a fancy gesture?
I would say limiting the user to add and delete but not edit would depend on your use case and what a row of your table represents. If it's a small piece of information (say a name) then it may be more sensible to just delete the wrong one and enter a new one rather than edit. If the row represents some larger object, then edit would probably be a good idea. What I would recommend to get that done, is pushing to some detail view controller when the row is tapped which would have it's own edit state and allows the user to change whatever they want with that object (like how the contacts app works).

Resources